Exemplo n.º 1
0
 public static IEnumerable <T> Distinct <T>(this IEnumerable <T> source, Func <T, object> uniqueCheckerMethod)
 {
     return(source.Distinct(new GenericComparer <T>(uniqueCheckerMethod)));
 }
 public static IEnumerable <T> Distinct <T>(
     this IEnumerable <T> source, Func <T, T, bool> comparer)
     where T : class
 => source.Distinct(new DynamicEqualityComparer <T>(comparer));
Exemplo n.º 3
0
 public static bool HasMoreThanOne <T>(this IEnumerable <T> source, Func <T, object> keySelector)
 {
     return(source.Distinct(keySelector).Count() > 1);
 }
Exemplo n.º 4
0
 public static IEnumerable <T> Distinct <T, TValue>(this IEnumerable <T> list, Func <T, TValue> body)
 {
     Verify.NotNull <IEnumerable <T> >(Expression.Lambda <Func <IEnumerable <T> > >(Expression.Field(Expression.Constant(null), FieldInfo.GetFieldFromHandle(typeof(EnumerableExtensions).GetField("list").FieldHandle, typeof(EnumerableExtensions).TypeHandle)), new ParameterExpression[0]), (string)null);
     Verify.NotNull <Func <T, TValue> >(Expression.Lambda <Func <Func <T, TValue> > >(Expression.Field(Expression.Constant(null), FieldInfo.GetFieldFromHandle(typeof(EnumerableExtensions).GetField("body").FieldHandle, typeof(EnumerableExtensions).TypeHandle)), new ParameterExpression[0]), (string)null);
     return(list.Distinct <T>(new EnumerableExtensions.GenericEqualityComparer <T, TValue>(body)));
 }