Skip to content

[API Proposal]: ExceptBy taking another collection of the source type #116005

Open
@weitzhandler

Description

@weitzhandler

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-suggestionEarly API idea and discussion, it is NOT ready for implementationarea-System.Linq

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions