c# - .Net equivalent of Java 'Collections.disjoint()' method? -
is there collections.disjoint()
(java language) api or library .net (c#)?
from api description:
disjoint returns true if 2 specified collections have no elements in common.
it sounds you're looking linq intersect
method:
bool disjoint = !collection1.intersect(collection2).any();
Comments
Post a Comment