/// <summary> /// 构造方法。 /// </summary> /// <param name="comparer"></param> public GeneralEqualityComparer(EqualityComparerHandler <T> comparer) { this._Comparer = comparer; }
/// <summary> /// 去除集合类中重复项 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="data"></param> /// <param name="comparer"></param> /// <returns></returns> public static IEnumerable <T> Distinct <T>(this IEnumerable <T> data, EqualityComparerHandler <T> comparer) { GeneralEqualityComparer <T> comparerClass = new GeneralEqualityComparer <T>(comparer); return(Enumerable.Distinct(data, comparerClass)); }