.Where(p => counties.Contains(p.CountyOfParticipationId))
Now, if there is a lot of data, be careful with the complexity of this. Contains in the list O (n), therefore, in general, the algorithm is O (n * m), where n, m are # participants and # districts.
For best performance, you can save the counties in a HashSet that contains O (1), which means O (n) as a whole.
Of course, if the number of counties is small, it does not matter, really.
EDIT . Just noted that your list does not contain identifiers, but complete objects. In order for the above code to work, you also need to change your linq query from select c to select c.Id or something like this (I don't know the name of the field).
source share