.NET has a number of set operations that work on enumerables, so you could take the set intersection to find members in both lists. Use Any()
to find out if the resulting sequence has any entries.
E.g.
if(list1.Intersect(list2).Any())
.NET has a number of set operations that work on enumerables, so you could take the set intersection to find members in both lists. Use Any()
to find out if the resulting sequence has any entries.
E.g.
if(list1.Intersect(list2).Any())