Question : c# list

hi,

I have a list below which gets some data and adds sid to it
which works fine.

What i want to know is how can i have a subnode/attribute of that top node in the list
so that i can add other relevant data to it.

For example one sid can have many names. So i have got all distinct sid from the data base
now i want to add the names to the sid.

Code below

Please help

Thanks,

R8vi
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
protected List<string> SID = new List<string>();

 string orginalsid = string.Empty;
            for (i = 0; i < icount; i++)
            {
                searchDataforsid= theData[i]["SID"].ToString();
                if (searchDataforsid!= orginalVehicleid)
                {
                    sID.Add(searchDataforsid);
                    orginalsid = theData[i]["sID"].ToString();
                }


            }

Answer : c# list

Sounds like you should be using a Dictionary<string, List<string>> instead. That will allow you to use the SID as the key and store as many associated entries as you like with it.
Random Solutions  
 
programming4us programming4us