Possible Duplicate:
Linq: List of lists to a long list
I have convert it using LINQ.
List<List<string>>
to List<string>.
If the leaves overlap one. Must be In one line.
Possible Duplicate:
Linq: List of lists to a long list
I have convert it using LINQ.
List<List<string>>
to List<string>.
If the leaves overlap one. Must be In one line.
Your question is a bit under specified.
input.SelectMany(list=>list).ToList()
This puts all strings that are part of any list into the result list. If you need only unique elements add .Distinct
between the SelectMany
and the ToList
List<List<string>> listOfLists = new List<List<string>>();
List<string> flattenedList = ListOfLists.SelectMany(x => x).ToList();