Avatar ·

How to apply Distinct() in LINQ only by one property of an object?

Hello everyone! I'm a beginner C# developer and I've encountered this problem. I have a list of objects of class `Product`: ```csharp public class Product { public int Id { get; set; } public string Name { get; set; } public decimal Price { get; set; } public string Category { get; set; } } ``` And there is a list: ```csharp List products = new List { new Product { Id = 1, Name = "Laptop", Price = 50000, Category = "Electronics" }, new Product { Id = 2, Name = "Mouse", Price = 1500, Category = "Electronics" }, new Product { Id = 3, Name = "Laptop", Price = 55000, Category = "Electronics" }, new Product { Id = 4, Name = "Book", Price = 500, Category = "Books" }, new Product { Id = 5, Name = "Mouse", Price = 1200, Categor