I am trying to find different combinations of values that will solve a solution. If the values (in a double array) pass a test I want to add them to a list, providing they are not already in the list.
If the list contains an array with values [1, 2, 3, 4, 5] and I check to see if the list contains array [5, 4, 3, 2, 1] List.Contains returns true. Is there anyway to search a list of arrays where order of the array matters?
I have tried List.Any(array.SequencyEqual) but that seems to have the same issue.
if(!myList.Any( a => a.SequenceEqual(myArray)))
{
//some code to print array values
myList.Add(myArray);
}
This if statement executes true once, then never again.
SequenceEqual, as the name suggests, does check the specific ordering. Show us the code you used that isn't working and explain what your expected outcome is.List<double[]>?