Madam Zu Zu
Madam Zu Zu

Reputation: 6605

Any value in the list - in LINQ

I need to pull all values where the request type is any of the ones I have on the list.

from v in ctx.vEmailSents
where  v.RequestType_ID == reqTypeID
group v by v.SentToLab_ID into g
select g.OrderByDescending(x => x.DateSent).FirstOrDefault() into lastV
  select new
  {
    ClaimID = lastV.Claim_ID,
  };

reqTypeID is of type List<int>.

How can I use it in Linq to get all records that are in that list?

Upvotes: 0

Views: 121

Answers (1)

Daniel Hilgarth
Daniel Hilgarth

Reputation: 174289

You can do something like this:

where requestTypes.Contains(v.RequestType_ID)

requestTypes would be the list you talked about.

Upvotes: 4

Related Questions