Simple script to combine elements within nested list.
-
static void Main(string[] args)
-
{
-
List<List<string>> nestedList = new List<List<string>>();
-
nestedList.Add(new List<string>() { “a”, “b”, “c” });
-
nestedList.Add(new List<string>() { “d”, “e”, “f” });
-
List<string> all = (from n in nestedList
-
from l in n
-
select l).ToList();
-
all.ForEach(new Action<string>(delegate(string s) { Console.WriteLine(s); }));
-
Console.ReadLine();
-
}
The output is “abcdef”