Does C# Linq Distinct has stopped working recently? Few months ago it was working like a charm now it is not. For example when I try to do this
Product[] products = { new Product { Name = "apple", Code = 9 },
new Product { Name = "orange", Code = 4 },
new Product { Name = "apple", Code = 9 },
new Product { Name = "lemon", Code = 12 } };
IEnumerable<Product> noduplicates =
products.Distinct();
foreach (var product in noduplicates)
Console.WriteLine(product.Name + " " + product.Code);
This code should produce the following output:
apple 9
orange 4
lemon 12
But it produces the following output: apple 9 orange 4 apple 9 lemon 12