Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i was wondering if someone can find a good list in list tut.

or can show me a example.


what I need to do is add a list with more than 100 items to one list.

somthing like.

list[1] = List2.ToArray();



wondering if i can add a list to a new list on index[1].
Posted
Comments
Mehdi Gholam 15-Apr-14 4:20am    
...and what is the problem?

I would start with MSDN documentation:

http://msdn.microsoft.com/en-us/library/6sh2ey19(v=vs.110).aspx[^]

Do you want something like this?

C#
List<string> listA = new List<string>();
listA.Add("codeproject");
listA.Add("tuesday");
 
List<string> listB = new List<string>();
listB.Add("codeproject");
listB.Add("tuesday");
 
List<List<string>> listOfList = new List<List<string>>();
 
listOfList.Add(listA);
listOfList.Add(listB);
 
Share this answer
 
v2
Comments
Wessel Beulink 15-Apr-14 4:53am    
yes that is what i was searching for, it wasn't that hard i see :)

thanks!
Manas Bhardwaj 15-Apr-14 4:57am    
Glad it helped!
You can have a list inside a list.
List<object> lst = new List<object>();
List<object> lstChild = new List<object>();
lst.add(lstChild);
 </object>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900