1
Answer

Remove everything which is duplicate in a List<List<double[]

HappyCode HappyCode

HappyCode HappyCode

9y
422
1

Hi, I hope you can help me out on this one.

 
I have a List < List < double[] > > and I want to remove everything which is duplicate in such list. That is:

1) Within the List < double[] > there are some of the double[] which are duplicate.I want to keep only the non-duplicate doubles[] within the List < double[] >. 

2) Within List < List < double[] > > there are some of the List < double[] > which are duplicate. I want to keep only the non-repeated lists. 

 
I have tried the following but it doesn't work.
public static List<List<double[]>> CleanListOfListsOfDoubleArray(List<List<double[]>> input)
{
      var output = new List<List<double[]>>();
      for (int i = 0; i < input.Count; i++)
      {
            var temp= input[i].Distinct().ToList();
            output.Add(temp);
      }
      return output.Distinct().ToList();
}
 
 
Any suggestions?
 
Many thanks!!! 

Answers (1)