It sounds like you’re trying to verify that all items in list2
are contained within at least one item in list1
. If that’s the case, this should do the trick:
bool list1ContainsList2Items = list2.All(l2 => list1.Any(l1 => l1.Contains(l2)));
2
solved Quickest way to compare two generic lists C# [closed]