array of arrays

P

plork

hi all, i'm calling a method that returns an array of arrays

[???] = id, title, desctiption

e.g.
[0] = "1000", "aaa", "some text"
[1] = "1000", "bbb", "some text"
[2] = "1000", "ccc", "some text"
[3] = "2000", "ddd", "some text"
[4] = "2000", "eee", "some text"
[5] = "3000", "fff", "some text"
[6] = "3000", "ggg", "some text"
[7] = "3000", "hhh", "some text"
[8] = "4000", "iii", "some text"
[9] = "5000", "jjj", "some text"
[10] = "6000", "kkk", "some text"

etc...

I do not know how many array will be with id 1000, or id 2000 or id
3000 etc...

Can someone show me how i can iterate through the array so i can
display the results

e.g. if id = 1000 - get the results and display, then get the next id
and the next etc

Thansk for any help
 
S

Som Nath Shukla

string[][] aa=new string[11][];
string [] s1={ "1000", "aaa", "some text"};
aa[0] =s1;

string[] s2 = { "1000", "bbb", "some text" };
aa[1] =s2;
string[] s10 = {"1000", "ccc", "some text"};
aa[2] = s10;
string[] s3 ={ "2000", "ddd", "some text"};
aa[3] = s3;
string[] s4 ={ "2000", "eee", "some text"};
aa[4] = s4;
string[] s5 ={ "3000", "fff", "some text"};
aa[5] = s5;
string[] s6 = {"3000", "ggg", "some text"};
aa[6] = s6;
string[] s7 = {"3000", "hhh", "some text"};
aa[7] = s7;
string[] s8 = {"4000", "iii", "some text"};
aa[8] = s8;
string[] s9 = {"5000", "jjj", "some text"};
aa[9] = s9;

foreach (Array a in aa)
{
foreach (string s in a)
{
if (s == "1000")
Console.WriteLine(s);

}
}



hi use this i hope it wil be helpfull. u can change ur condition in inner
loop to check what u want
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Arrays 22
Compare cells in different worksheets 3
Group/Sort records in Excel 1
DataGridItem.FindControl() (REPOST) 2
Excel Issue 1
EXCEL issue 3
Lookup with loop 3
row comparison 5

Top