Enumerable.IntersectBy メソッド

定義

オーバーロード

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

指定したキー セレクター関数に従って、2 つのシーケンスの集合積集合を生成します。

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

指定したキー セレクター関数に従って、2 つのシーケンスの集合積集合を生成します。

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

ソース:
Intersect.cs
ソース:
Intersect.cs
ソース:
Intersect.cs

指定したキー セレクター関数に従って、2 つのシーケンスの集合積集合を生成します。

public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
 static System::Collections::Generic::IEnumerable<TSource> ^ IntersectBy(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> IntersectBy<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 IntersectBy : seq<'Source> * seq<'Key> * Func<'Source, 'Key> * System.Collections.Generic.IEqualityComparer<'Key> -> seq<'Source>
<Extension()>
Public Function IntersectBy(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)

型パラメーター

TSource

入力シーケンスの要素の型。

TKey

要素を識別するキーの種類。

パラメーター

first
IEnumerable<TSource>

second にも含まれる、返される一意の要素を含む IEnumerable<T>

second
IEnumerable<TKey>

最初のシーケンスにも含まれる、返される一意の要素を含む IEnumerable<T>

keySelector
Func<TSource,TKey>

各要素のキーを抽出する関数。

comparer
IEqualityComparer<TKey>

キーを比較する IEqualityComparer<T>

戻り値

IEnumerable<TSource>

2 つのシーケンスの積集合を構成する要素が格納されているシーケンス。

例外

first または secondnull です。

注釈

このメソッドは、遅延実行を使用して実装されます。 即時戻り値は、アクションの実行に必要なすべての情報を格納する オブジェクトです。 このメソッドで表されるクエリは、オブジェクトがメソッドを直接呼び出GetEnumeratorすか、C# For Each または Visual Basic で を使用foreachして列挙されるまで実行されません。

2 つのセット A と B の積集合は、B にも出現する A のすべての要素を含むセットとして定義されますが、他の要素は含んでいません。

このメソッドによって返されるオブジェクトが列挙されると、 Intersect 両方のシーケンスで 出現する順序で異なる要素が生成されます first

nullの場合comparerDefault既定の等値比較子 である が値の比較に使用されます。

こちらもご覧ください

適用対象

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

ソース:
Intersect.cs
ソース:
Intersect.cs
ソース:
Intersect.cs

指定したキー セレクター関数に従って、2 つのシーケンスの集合積集合を生成します。

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

型パラメーター

TSource

入力シーケンスの要素の型。

TKey

要素を識別するキーの種類。

パラメーター

first
IEnumerable<TSource>

second にも含まれる、返される一意の要素を含む IEnumerable<T>

second
IEnumerable<TKey>

最初のシーケンスにも含まれる、返される一意の要素を含む IEnumerable<T>

keySelector
Func<TSource,TKey>

各要素のキーを抽出する関数。

戻り値

IEnumerable<TSource>

2 つのシーケンスの積集合を構成する要素が格納されているシーケンス。

例外

first または secondnull です。

注釈

このメソッドは、遅延実行を使用して実装されます。 即時戻り値は、アクションの実行に必要なすべての情報を格納する オブジェクトです。 このメソッドで表されるクエリは、オブジェクトがメソッドを直接呼び出GetEnumeratorすか、C# For Each または Visual Basic で を使用foreachして列挙されるまで実行されません。

2 つのセット A と B の積集合は、B にも出現する A のすべての要素を含むセットとして定義されますが、他の要素は含んでいません。

このメソッドによって返されるオブジェクトが列挙されると、 Intersect 両方のシーケンスで 出現する順序で異なる要素が生成されます first

既定の等値比較子 は、 Default値の比較に使用されます。

こちらもご覧ください

適用対象