Enumerable.ExceptBy Method

Definition

Overloads

ExceptBy<TSource,TKey>(IEnumerable<TSource>, IEnumerable<TKey>, Func<TSource,TKey>)

Produces the set difference of two sequences according to a specified key selector function.

ExceptBy<TSource,TKey>(IEnumerable<TSource>, IEnumerable<TKey>, Func<TSource,TKey>, IEqualityComparer<TKey>)

Produces the set difference of two sequences according to a specified key selector function.

ExceptBy<TSource,TKey>(IEnumerable<TSource>, IEnumerable<TKey>, Func<TSource,TKey>)

Produces the set difference of two sequences according to a specified key selector function.

public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
 static System::Collections::Generic::IEnumerable<TSource> ^ ExceptBy(System::Collections::Generic::IEnumerable<TSource> ^ first, System::Collections::Generic::IEnumerable<TKey> ^ second, Func<TSource, TKey> ^ keySelector);
public static System.Collections.Generic.IEnumerable<TSource> ExceptBy<TSource,TKey> (this System.Collections.Generic.IEnumerable<TSource> first, System.Collections.Generic.IEnumerable<TKey> second, Func<TSource,TKey> keySelector);
static member ExceptBy : seq<'Source> * seq<'Key> * Func<'Source, 'Key> -> seq<'Source>
<Extension()>
Public Function ExceptBy(Of TSource, TKey) (first As IEnumerable(Of TSource), second As IEnumerable(Of TKey), keySelector As Func(Of TSource, TKey)) As IEnumerable(Of TSource)

Type Parameters

TSource

The type of the elements of the input sequence.

TKey

The type of key to identify elements by.

Parameters

first
IEnumerable<TSource>

An IEnumerable<T> whose keys that are not also in second will be returned.

second
IEnumerable<TKey>

An IEnumerable<T> whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.

keySelector
Func<TSource,TKey>

A function to extract the key for each element.

Returns

IEnumerable<TSource>

A sequence that contains the set difference of the elements of two sequences.

See also

Applies to

ExceptBy<TSource,TKey>(IEnumerable<TSource>, IEnumerable<TKey>, Func<TSource,TKey>, IEqualityComparer<TKey>)

Produces the set difference of two sequences according to a specified key selector function.

public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
 static System::Collections::Generic::IEnumerable<TSource> ^ ExceptBy(System::Collections::Generic::IEnumerable<TSource> ^ first, System::Collections::Generic::IEnumerable<TKey> ^ second, Func<TSource, TKey> ^ keySelector, System::Collections::Generic::IEqualityComparer<TKey> ^ comparer);
public static System.Collections.Generic.IEnumerable<TSource> ExceptBy<TSource,TKey> (this System.Collections.Generic.IEnumerable<TSource> first, System.Collections.Generic.IEnumerable<TKey> second, Func<TSource,TKey> keySelector, System.Collections.Generic.IEqualityComparer<TKey>? comparer);
static member ExceptBy : seq<'Source> * seq<'Key> * Func<'Source, 'Key> * System.Collections.Generic.IEqualityComparer<'Key> -> seq<'Source>
<Extension()>
Public Function ExceptBy(Of TSource, TKey) (first As IEnumerable(Of TSource), second As IEnumerable(Of TKey), keySelector As Func(Of TSource, TKey), comparer As IEqualityComparer(Of TKey)) As IEnumerable(Of TSource)

Type Parameters

TSource

The type of the elements of the input sequence.

TKey

The type of key to identify elements by.

Parameters

first
IEnumerable<TSource>

An IEnumerable<T> whose keys that are not also in second will be returned.

second
IEnumerable<TKey>

An IEnumerable<T> whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.

keySelector
Func<TSource,TKey>

A function to extract the key for each element.

comparer
IEqualityComparer<TKey>

The IEqualityComparer<T> to compare values.

Returns

IEnumerable<TSource>

A sequence that contains the set difference of the elements of two sequences.

See also

Applies to