Enumerable.IntersectBy メソッド

定義

オーバーロード

名前 説明
IntersectBy<TSource,TKey>(IEnumerable<TSource>, IEnumerable<TKey>, Func<TSource,TKey>)

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

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

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

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

ソース:
Intersect.cs
ソース:
Intersect.cs
ソース:
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>

IEnumerable<T>にも出現する個別の要素が返されるsecond

second
IEnumerable<TKey>

最初のシーケンスにも出現する個別の要素が返される IEnumerable<T>

keySelector
Func<TSource,TKey>

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

返品

IEnumerable<TSource>

2 つのシーケンスの集合積集合を形成する要素を含むシーケンス。

例外

first または secondnull

注釈

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

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

このメソッドによって返されるオブジェクトを列挙すると、 Intersect は、 firstに表示される順序で、両方のシーケンスで発生する個別の要素を生成します。

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

こちらもご覧ください

適用対象

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

ソース:
Intersect.cs
ソース:
Intersect.cs
ソース:
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>

IEnumerable<T>にも出現する個別の要素が返されるsecond

second
IEnumerable<TKey>

最初のシーケンスにも出現する個別の要素が返される IEnumerable<T>

keySelector
Func<TSource,TKey>

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

comparer
IEqualityComparer<TKey>

キーを比較する IEqualityComparer<T>

返品

IEnumerable<TSource>

2 つのシーケンスの集合積集合を形成する要素を含むシーケンス。

例外

first または secondnull

注釈

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

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

このメソッドによって返されるオブジェクトを列挙すると、 Intersect は、 firstに表示される順序で、両方のシーケンスで発生する個別の要素を生成します。

comparernullの場合、既定の等値比較子 (Default) を使用して値が比較されます。

こちらもご覧ください

適用対象