I current have some objects in an array like this node[1][1]
, there are multiple child objects/variables for each parent eg.. node[1][2]
, node[1][3]
etc..
There are also multiple parent objetcs eg.. node[2][1]
, node[3][1]
etc..
What I want to do is bind/Display all child objects in a listbox from all parents
eg.. listBox1.itemsource = node[All][1];
I have done some research but can't find any way to do this?
Any help would be appreciated.
I found my own solution for this. Using foreach and then if statement to find and display specfic element
Examples Code * ** * ** * ** * ** * ** * *
// statements_foreach_arrays.cs
// Using foreach with arrays
using System;
class MainClass
{
public static void Main()
{
int odd = 0, even = 0;
int[] arr = new int [] {0,1,2,5,7,8,11};
foreach (int i in arr)
{
if (i%2 == 0)
even++;
else
odd++;
}
Console.WriteLine("Found {0} Odd Numbers, and {1} Even Numbers.",
odd, even) ;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.