List<string> outputList = resultList.Distinct(new Compare<string>((x, y) => (null != x && null != y) && (x == y))).ToList();//去除重复项
#region 泛型类扩展
public delegate bool EqualsComparer<T>(T x, T y);
public class Compare<T> : IEqualityComparer<T>
{
private EqualsComparer<T> _equalsComparer;
public Compare(EqualsComparer<T> equalsComparer)
{
this._equalsComparer = equalsComparer;
}
public bool Equals(T x, T y)
{
if (null != this._equalsComparer)
return this._equalsComparer(x, y);
else
return false;
}
public int GetHashCode(T obj)
{
return obj.ToString().GetHashCode();
}
}
#endregion