我正在使用两种方式对客户进行模糊搜索。一种是通过缩写名称,另一种是通过客户的全名。当我将这两个结果集合并在一起(根据我读过的几个地方应该会删除不同的值),我得到了重复项。我认为我只需要在此之后调用.Distinct()
方法,但我仍然得到重复项。我需要在我的客户对象中实现一些比较功能吗?
Dim shortNameMatch As List(Of ICustomer) = CustomerLibrary.GetCustomersByShortName(term)
Dim custNameMatch As List(Of ICustomer) = CustomerLibrary.GetCustomersByCustName(term)
Dim allMatch = (From a In (From s In shortNameMatch Select s).Union(From c In custNameMatch Select c) Select a).Distinct()