.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())
You can always use linq
if (list1.Intersect(list2).Count() > 0) ...
If you're able to use Linq then if(list1.Intersect(list2).Count > 0) {...collision...}
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With