首先看看 List<T> 是如何实现 IList.Remove 的:

This method determines equality using the default equality comparer
 EqualityComparer.Default for T, the type of values in the list.

   原来,List<T> 在 IList.Remove 中使用 EqualityComparer.Default 来判断两个对象是否相等。那么 EqualityComparer.Default 又是如何得知两个对象是否相等呢?

The Default property checks whether type T implements the System.IEquatable generic 
interface and if so returns an EqualityComparer that uses that implementation. 
Otherwise it returns an EqualityComparer that uses the overrides of Object.Equals and Object.GetHashCode provided by T.

我们可以发现 List<T> 中的 IList.Remove 判断两个 Product 对象是否相等的方法是从 Object 根类继承下来的 Equals 和 GetHashCode 方法,即比较两个对象的引用是否指向同一个对象。

解决方案:

   例:

public override bool Equals(object obj)
{
if(this.GetType() == typeof(Product)){
return true;
}
return false;
}

原文链接:http://www.cnblogs.com/allenlooplee/archive/2007/01/06/613608.html