Consider we have these three lists:
List<string> l1= new List<string>(){"A","B","C"};
List<string> l2= new List<string>(){"A","C","B"};
List<string> l3= new List<string>(){"B","C"};
I need LINQ query which say l1 includes l3 but l2 doesn’t.
To respect the order and account for possible duplicate elements you have to enumerate the sequence, one way of doing it would be to check for each start position in the source enumeration if the other sequence starts here, e.g. using an extension method:
Note that this would be O(n2) since worst case you have fully enumerate the
otherenumeration for each item in thesourcecollection.Now you can do: