我想知道是否可以使用 HashSet 并使方法Contains返回 true 如果字段之一在给定对象的哈希中。
这是我想要的一个例子
static void Main(string[] args)
{
HashSet<Product> hash = new HashSet<Product>();
// Since the Id is the same, both products are considered to be the same even if the URI is not the same
// The opposite is also true. If the URI is the same, both products are considered to be the same even if the Id is not the same
Product product1 = new Product("123", "www.test.com/123.html");
Product product2 = new Product("123", …Run Code Online (Sandbox Code Playgroud)