user2743684
user2743684

Reputation: 25

List Of Items Appearing In Another List

I have a list of Strings. I want to do a query like the following:

SentEmails is another list that comes from the database.

SentEmails.Where(Function(x)x.EmailSentTo = [any of the items in my original email address list]

But I'm not sure how to achieve this. Bascially I want to remove any email addresses from SentEmails that aren't in my original list.

Upvotes: 1

Views: 49

Answers (1)

MarcinJuraszek
MarcinJuraszek

Reputation: 125650

Use Contains extension method:

SentEmails.Where(Function(x) OriginalList.Contains(x.EmailSentTo))

Upvotes: 1

Related Questions