т.е. это проходит:
Код: Выделить всё
public record Person
{
public string FirstName { get; set; }
}
HashSet
uniquePeople = new();
uniquePeople.Add(new Person { FirstName = "John" });
uniquePeople.Add(new Person { FirstName = "John" });
Assert.That(uniquePeople.Count() == 1);
Код: Выделить всё
public record Person
{
public string FirstName { get; set; }
public HashSet FavouriteNumbers { get; set; } = new();
}
HashSet
uniquePeople = new();
uniquePeople.Add(new Person { FirstName = "John" });
uniquePeople.Add(new Person { FirstName = "John" });
Assert.That(uniquePeople.Count() == 1);
Подробнее здесь: https://stackoverflow.com/questions/784 ... collection