LINQ C# complex nesting structure

前端 未结 2 570
旧时难觅i
旧时难觅i 2021-01-14 18:10

I managed to make a selection from the complex structure of the object, but only with the help of foreach, how can I avoid this foreach and solve my problem, just using LINQ

2条回答
  •  青春惊慌失措
    2021-01-14 18:36

    Are you looking for something like this?

    product.ForEach(item => item.Strucutre.CheckList.Checks = item.Strucutre.CheckList.Checks.Where(w => numbers.Contains(w.NumberAsInt)).Select(w => w).ToList());
    

提交回复
热议问题