Saturday, 31 August 2013

How to remove each item that appeares in first collection from second collection using linq?

How to remove each item that appeares in first collection from second
collection using linq?

Suppose I have 2 collections:
1) {1, 2, 3, 5}
2) {2, 5}
I want to remove each item that appears in second collection from first
collection, so I will get:
{1, 3}
Questions:
How can I do this with Join OP (better with extension methods syntax)?
And is there any way I can iterate over two collections as I do with
nested for/foreach loops?

No comments:

Post a Comment