public class ComparerHelper : IEqualityComparer<Model>
{
public bool Equals(Model x, Model y)
{
return x.Name== y.Name;
}
public int GetHashCode(Model obj)
{
return obj.Title.GetHashCode();
}
}
//调用
modelList = modelList.Distinct(new ComparerHelper()).ToList();