I am working with WPF and c#. I have a list of objects. Example: List<Employee> and the employee class has a property departmentID_A and departmentID_B.
The user has a list of checkbox with the departments name to filter the list.
I want to filter the list by the “in statement” something like this:
EmployeeList.Find(p => p.departmentID_A in (1, 2, 3));
Is any way that I can do this?
I am working with WPF and c#. I have a list of objects. Example:
Share
If your filter contains many items you should use
Note that the LINQ query returns an IEnumerable. It does not filter a list in place. If you want a List or Array you can call
ToList()orToArray()on your result and you may use pure function calls: