I have a collection with objects in it, one of these objects attribute is a PublishRequestStatus, which is an enum value.
I'm recieving another list of all enum values that it needs to match, now I know how to search for 1 attribute matching a value:
model = model.Where(x => x.PublishRequestStatus == PublishRequestStatus.Denied);
But I'm having trouble matching all possible values from another collection. For example if I have a collection with PublishRequestStatus.Approved
and PublishRequestStatus.Denied
, how would I use LINQ to search for all objects with either of those enum values?
The only thing that I found what works is to make one list for each enum value in the 2nd collection in a loop, and at the end join all the lists together. However, I'm pretty sure that LINQ has a better way of doing what I'm trying to achieve.