Enumerable.IntersectBy メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
オーバーロード
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>)
指定したキー セレクター関数に従って、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
または second
が null
です。
注釈
このメソッドは、遅延実行を使用して実装されます。 即時戻り値は、アクションの実行に必要なすべての情報を格納するオブジェクトです。 か、呼び出すことによって、オブジェクトが列挙されるまで、このメソッドによって表されるクエリは実行されません、GetEnumerator
メソッドを使用して直接またはforeach
Visual C# またはFor Each
Visual Basic で。
2 つのセット A と B の積集合は、B にも出現する A のすべての要素を含むセットとして定義されますが、他の要素は含んでいません。
このメソッドによって返されるオブジェクトが列挙されると、 Intersect
両方のシーケンスで出現する順序で個別の要素が生成されます first
。
if comparer
is null
, the default equality comparer, Default, is used to compare values.
こちらもご覧ください
適用対象
IntersectBy<TSource,TKey>(IEnumerable<TSource>, IEnumerable<TKey>, Func<TSource,TKey>)
指定したキー セレクター関数に従って、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
または second
が null
です。
注釈
このメソッドは、遅延実行を使用して実装されます。 即時戻り値は、アクションの実行に必要なすべての情報を格納するオブジェクトです。 か、呼び出すことによって、オブジェクトが列挙されるまで、このメソッドによって表されるクエリは実行されません、GetEnumerator
メソッドを使用して直接またはforeach
Visual C# またはFor Each
Visual Basic で。
2 つのセット A と B の積集合は、B にも出現する A のすべての要素を含むセットとして定義されますが、他の要素は含んでいません。
このメソッドによって返されるオブジェクトが列挙されると、 Intersect
両方のシーケンスで出現する順序で個別の要素が生成されます first
。
値の比較には、 Default既定の等値比較子が使用されます。