Filtering lists using LINQ

前端 未结 9 2149
暖寄归人
暖寄归人 2021-02-04 00:23

I\'ve got a list of People that are returned from an external app and I\'m creating an exclusion list in my local app to give me the option of manually removing people from the

9条回答
  •  情深已故
    2021-02-04 00:32

    I would just use the FindAll method on the List class. i.e.:

    List filteredResults = 
        people.FindAll(p => return !exclusions.Contains(p));
    

    Not sure if the syntax will exactly match your objects, but I think you can see where I'm going with this.

提交回复
热议问题