I am new to LINQ/C#. I have an enumerable list:
System.Collections.Generic.IEnumerable<System.Collections.Generic.List>
I would like to extract the first item from each list and place that in a new list:
System.Collections.Generic.List
For example
List<customers> = from myEnumerable
select item[0];
What would be the correct way to form the linq query to extract element 0 from each list in the enumerable?
Thank You
CodePudding user response:
What would be the correct way to form the linq query to extract element 0 from each list in the enumerable?
IEnumerable<List<T>> input = ...;
var result = input.Select(l => l[0]).ToList();