Skip to content

Instantly share code, notes, and snippets.

@mladenb
mladenb / ExceptBy.cs
Created April 4, 2019 07:28
.NET Core ExceptBy / IntersectBy
public static IEnumerable<TFirst> ExceptBy<TFirst, TSecond>(this IEnumerable<TFirst> first, Func<TFirst, TSecond> mappingFunc, IEnumerable<TSecond> second)
{
if (first == null) throw new ArgumentNullException(nameof(first));
if (second == null) throw new ArgumentNullException(nameof(second));
return ExceptByIterator(first, mappingFunc, second, null);
}
public static IEnumerable<TFirst> ExceptBy<TFirst, TSecond>(this IEnumerable<TFirst> first, Func<TFirst, TSecond> mappingFunc, IEnumerable<TSecond> second, IEqualityComparer<TSecond> comparer)
{