Click to See Complete Forum and Search --> : [RESOLVED] List in a List? List<List<string>>


Visslan
February 4th, 2009, 04:12 AM
I want to make a List containing a List that contains strings. I don't know how to do that. Can I get a code example please?

dannystommen
February 4th, 2009, 04:26 AM
You already have the answer in your title. ;-)

A little example


List<List<string>> doubleStringList = new List<List<string>>();

List<string> tempList = new List<string>();
tempList.Add("list1");
doubleStringList.Add(tempList);

List<string> tempList2 = new List<string>();
tempList2.Add("list2");
tempList2.Add("list2secondItem");
doubleStringList.Add(tempList2);


Debug and see what's in the doubleStringList

Visslan
February 4th, 2009, 04:44 AM
haha I was to quick to ask has just missed the () :D!! Thank you!!