[英]How read the data of Type IDictionary<string,EntityType> contains collection of values... how to read this item in List collection
數據看起來像 [0]:[0]{[item,{item1}]} [2]{[item,{item2}]}
[2]{[item,{item2}]} 它就像集合中的集合......我正在嘗試將它作為列表以便我可以檢索它。 任何幫助真的很感激....
您絕對應該看看 Linq 中的 SelectMany。 從您寫的內容來看,我不確定您想要實現什么。 作為參考嘗試分析此代碼:
var dictionary = new Dictionary<int, IEnumerable<int>> {
[1] = Enumerable.Range(1,5),
[3] = Enumerable.Range(3, 5)
};
var asList = dictionary.SelectMany(keyValuePair => keyValuePair.Value.Prepend(keyValuePair.Key));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.