If you have a list of arrays like:
List<int[]> ListOfArrays = new List<int[]>(); ListOfArrays.Add(new int[] { 1, 1 }); ListOfArrays.Add(new int[] { 2, 1 });
How do you find the index {2, 1} in the list?
I do not want to use an iteration loop. I would like to use a compressed method similar to what PaRiMaL RaJ suggested in Check if a string array exists in a list of strings :
list.Select(ar2 => arr.All(ar2.Contains)).FirstOrDefault();
(the above code will return true if the members of the given array of strings exist in the list of string arrays)
Saeid source share