I have a list containing objects, but these objects are not unique in the list. I use this code to make them unique in another list:
foreach (CategoryProductsResult categoryProductsResult in categoryProductsResults.Where(categoryProductsResult => !resultSet.Contains(categoryProductsResult)))
{
resultSet.Add(categoryProductsResult);
}
But at the end, resultSet matches theProductsResults category.
categoryProducts Repeated second line:

resultSet first line:

As you can see, the first line of resultSet and categoryProductsResult the second line is the same, but it adds the second line to resultSet.
Do you have any suggestions?
source
share