我已經List<List < Address>> 并且我正在嘗試從父串列中檢索子串列中的元素,下面是我所做的,但這不是我想要實作的
var getChildElement = ParentList
.Select(x => x.Select(y => y)
.Where(z => z.Stud.Res.StudentId == 54));
uj5u.com熱心網友回復:
關于什么 SelectMany()
將序列的每個元素投影到 IEnumerable 并將 結果序列展平為一個序列。
var getChildElement = ParentList.SelectMany(x => x.Stud.Res.StudentId == 54);
如檔案中所述,將SelectMany()您的資料展平List<List<Address>>為一個序列,我們的謂詞將該序列過濾到輸出中。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/388405.html
上一篇:不確定為什么在使用SQLAlchemy時出現執行緒ID錯誤
下一篇:洗掉包含初始字串一部分的所有出現
