我是LINQ/C#的新手。 我有一個可列舉的串列:
System.Collections.Generic.IEnumerable<System.Collections.Generic.List>
我想從每個串列中提取第一個專案,并將其放入一個新的串列中:
System.Collections.Generic.List
例如
List<customers> = from myEnumerable
select item[0] 。
什么是正確的方式來形成linq查詢,以便從enumerable的每個串列中提取元素0?
謝謝你
uj5u.com熱心網友回復:
什么是正確的方式來形成linq查詢,從enumerable中的每個串列中提取元素0?
IEnumerable<List<T>> input = ...。
var result = input.Select(l => l[0] ).ToList();
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/310062.html
標籤:
