score:106

Accepted answer

sounds like you just want:

bool hassameelements = lista.intersect(listb).any();

edit: as noted in comments, intersect uses lazy evaluation. it defers all execution until the first element is read from the result; at that point it will load all of listb into a set, and then stream lista until it finds a result to yield. at that point, any() will return true and so no more work will be done. see my edulinq post on intersect for more information.


Related Query

More Query from same tag