user673740
user673740

Reputation: 203

LINQ to Objects - NOT IN query

I have two string arrays (let call them “AllEmployees”, and “ActiveEmployees”) that I’d like to compare with LINQ to find all inactive employees (basically all those in AllEmployees that aren’t in ActiveEmployees.

How can I do that using LinQ?

Thanks!

Upvotes: 1

Views: 669

Answers (1)

Corbin March
Corbin March

Reputation: 25734

How about?:

var inactiveEmployees = AllEmployees.Except(ActiveEmployees);

System.Linq.Enumerable.Except

Upvotes: 10

Related Questions