Open
Description
Background and motivation
Please add an overload of ExceptBy
that takes another collection of the source type (instead of TKey
type). The same keySelector
will then be used to obtain the keys from both collections.
Related #115797
API Proposal
namespace System.Collections.Generic;
public static class Enumerable
{
+ public static IEnumerable<TSource> ExceptBy<TSource, TKey>(
this IEnumerable<TSource> first,
IEnumerable<TSource> second,
Func<TSource, TKey> keySelector);
}
API Usage
IEnumerable<Source> x = ...;
IEnumerable<Source> y = ...;
var excepted = x.ExceptBy(y, source => source.Key);
Alternative Designs
No response
Risks
No response