Skip to content

Instantly share code, notes, and snippets.

@beufordy3k
Created January 22, 2016 19:31
Show Gist options
  • Save beufordy3k/8df5e73560f29afd4ba9 to your computer and use it in GitHub Desktop.
Save beufordy3k/8df5e73560f29afd4ba9 to your computer and use it in GitHub Desktop.
Enumerable extension methods that utilize the LambdaComparer
public static class EnumerableExtensions
{
public static IEnumerable<TSource> Distinct<TSource>(this IEnumerable<TSource> enumerable, Func<TSource, TSource, bool> comparer)
{
return enumerable.Distinct(new LambdaComparer<TSource>(comparer));
}
public static IEnumerable<TSource> Except<TSource>(this IEnumerable<TSource> enumerable, IEnumerable<TSource> comparison, Func<TSource, TSource, bool> comparer)
{
return enumerable.Except(comparison, new LambdaComparer<TSource>(comparer));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment