C#: LINQ string array except another string array

Trabla: C#: LINQ string array except another string array

Solving: 

Use Except method


...

string[] cities = { "London", "New York", "Kiev", "Odessa" };
string[] ukraineCities = { "Kiev", "Odessa" };

var exceptUkraineCities = cities.Except( ukraineCities   );

....

No comments:

Post a Comment