次の方法で共有


Queryable.Zip メソッド

定義

オーバーロード

名前 説明
Zip<TFirst,TSecond,TResult>(IQueryable<TFirst>, IEnumerable<TSecond>, Expression<Func<TFirst,TSecond,TResult>>)

指定した述語関数を使用して、2 つのシーケンスをマージします。

Zip<TFirst,TSecond,TThird>(IQueryable<TFirst>, IEnumerable<TSecond>, IEnumerable<TThird>)

指定された 3 つのシーケンスの要素を持つタプルのシーケンスを生成します。

Zip<TFirst,TSecond>(IQueryable<TFirst>, IEnumerable<TSecond>)

指定した 2 つのシーケンスの要素を含むタプルのシーケンスを生成します。

Zip<TFirst,TSecond,TResult>(IQueryable<TFirst>, IEnumerable<TSecond>, Expression<Func<TFirst,TSecond,TResult>>)

ソース:
Queryable.cs
ソース:
Queryable.cs
ソース:
Queryable.cs
ソース:
Queryable.cs
ソース:
Queryable.cs

指定した述語関数を使用して、2 つのシーケンスをマージします。

public:
generic <typename TFirst, typename TSecond, typename TResult>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::IQueryable<TResult> ^ Zip(System::Linq::IQueryable<TFirst> ^ source1, System::Collections::Generic::IEnumerable<TSecond> ^ source2, System::Linq::Expressions::Expression<Func<TFirst, TSecond, TResult> ^> ^ resultSelector);
public static System.Linq.IQueryable<TResult> Zip<TFirst,TSecond,TResult>(this System.Linq.IQueryable<TFirst> source1, System.Collections.Generic.IEnumerable<TSecond> source2, System.Linq.Expressions.Expression<Func<TFirst,TSecond,TResult>> resultSelector);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")]
public static System.Linq.IQueryable<TResult> Zip<TFirst,TSecond,TResult>(this System.Linq.IQueryable<TFirst> source1, System.Collections.Generic.IEnumerable<TSecond> source2, System.Linq.Expressions.Expression<Func<TFirst,TSecond,TResult>> resultSelector);
static member Zip : System.Linq.IQueryable<'First> * seq<'Second> * System.Linq.Expressions.Expression<Func<'First, 'Second, 'Result>> -> System.Linq.IQueryable<'Result>
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")>]
static member Zip : System.Linq.IQueryable<'First> * seq<'Second> * System.Linq.Expressions.Expression<Func<'First, 'Second, 'Result>> -> System.Linq.IQueryable<'Result>
<Extension()>
Public Function Zip(Of TFirst, TSecond, TResult) (source1 As IQueryable(Of TFirst), source2 As IEnumerable(Of TSecond), resultSelector As Expression(Of Func(Of TFirst, TSecond, TResult))) As IQueryable(Of TResult)

型パラメーター

TFirst

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

TSecond

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

TResult

結果シーケンスの要素の型。

パラメーター

source1
IQueryable<TFirst>

マージする最初のシーケンス。

source2
IEnumerable<TSecond>

マージする 2 番目のシーケンス。

resultSelector
Expression<Func<TFirst,TSecond,TResult>>

2 つのシーケンスの要素をマージする方法を指定する関数。

戻り値

IQueryable<TResult>

2 つの入力シーケンスのマージされた要素を含む IQueryable<T>

属性

例外

source1 または source2null

次のコード例では、 Zip メソッドを使用して 2 つのシーケンスをマージする方法を示します。

int[] numbers = { 1, 2, 3, 4 };
string[] words = { "one", "two", "three" };

var numbersAndWords = numbers.AsQueryable().Zip(words, (first, second) => first + " " + second);

foreach (var item in numbersAndWords)
    Console.WriteLine(item);

// This code produces the following output:

// 1 one
// 2 two
// 3 three
Dim numbers() As Integer = {1, 2, 3, 4}
Dim words() As String = {"one", "two", "three"}
Dim numbersAndWords = numbers.AsQueryable().Zip(words, Function(first, second) first & " " & second)

For Each item In numbersAndWords
    Console.WriteLine(item)
Next

' This code produces the following output:

' 1 one
' 2 two
' 3 three

注釈

Zip メソッドは、構築されたジェネリック メソッドとしての呼び出しZip自体を表すMethodCallExpressionを生成します。 次に、source1 パラメーターのProvider プロパティで表されるIQueryProviderCreateQuery<TElement>(Expression) メソッドにMethodCallExpressionを渡します。

このメソッドは、最初のシーケンスの各要素を、2 番目のシーケンスで同じインデックスを持つ要素とマージします。 シーケンスが同じ数の要素を持たない場合、メソッドはいずれかの要素の末尾に達するまでシーケンスをマージします。 たとえば、1 つのシーケンスに 3 つの要素があり、もう 1 つのシーケンスに 4 つの要素がある場合、結果のシーケンスには 3 つの要素のみが含まれます。

適用対象

Zip<TFirst,TSecond,TThird>(IQueryable<TFirst>, IEnumerable<TSecond>, IEnumerable<TThird>)

ソース:
Queryable.cs
ソース:
Queryable.cs
ソース:
Queryable.cs
ソース:
Queryable.cs
ソース:
Queryable.cs

指定された 3 つのシーケンスの要素を持つタプルのシーケンスを生成します。

public:
generic <typename TFirst, typename TSecond, typename TThird>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::IQueryable<ValueTuple<TFirst, TSecond, TThird>> ^ Zip(System::Linq::IQueryable<TFirst> ^ source1, System::Collections::Generic::IEnumerable<TSecond> ^ source2, System::Collections::Generic::IEnumerable<TThird> ^ source3);
public static System.Linq.IQueryable<(TFirst First, TSecond Second, TThird Third)> Zip<TFirst,TSecond,TThird>(this System.Linq.IQueryable<TFirst> source1, System.Collections.Generic.IEnumerable<TSecond> source2, System.Collections.Generic.IEnumerable<TThird> source3);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")]
public static System.Linq.IQueryable<(TFirst First, TSecond Second, TThird Third)> Zip<TFirst,TSecond,TThird>(this System.Linq.IQueryable<TFirst> source1, System.Collections.Generic.IEnumerable<TSecond> source2, System.Collections.Generic.IEnumerable<TThird> source3);
static member Zip : System.Linq.IQueryable<'First> * seq<'Second> * seq<'hird> -> System.Linq.IQueryable<ValueTuple<'First, 'Second, 'hird>>
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")>]
static member Zip : System.Linq.IQueryable<'First> * seq<'Second> * seq<'hird> -> System.Linq.IQueryable<ValueTuple<'First, 'Second, 'hird>>
<Extension()>
Public Function Zip(Of TFirst, TSecond, TThird) (source1 As IQueryable(Of TFirst), source2 As IEnumerable(Of TSecond), source3 As IEnumerable(Of TThird)) As IQueryable(Of ValueTuple(Of TFirst, TSecond, TThird))

型パラメーター

TFirst

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

TSecond

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

TThird

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

パラメーター

source1
IQueryable<TFirst>

マージする最初のシーケンス。

source2
IEnumerable<TSecond>

マージする 2 番目のシーケンス。

source3
IEnumerable<TThird>

マージする 3 番目のシーケンス。

戻り値

IQueryable<ValueTuple<TFirst,TSecond,TThird>>

最初のシーケンス、2 番目、3 番目のシーケンスから取得された要素を含むタプルのシーケンス。その順序です。

属性

適用対象

Zip<TFirst,TSecond>(IQueryable<TFirst>, IEnumerable<TSecond>)

ソース:
Queryable.cs
ソース:
Queryable.cs
ソース:
Queryable.cs
ソース:
Queryable.cs
ソース:
Queryable.cs

指定した 2 つのシーケンスの要素を含むタプルのシーケンスを生成します。

public:
generic <typename TFirst, typename TSecond>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::IQueryable<ValueTuple<TFirst, TSecond>> ^ Zip(System::Linq::IQueryable<TFirst> ^ source1, System::Collections::Generic::IEnumerable<TSecond> ^ source2);
public static System.Linq.IQueryable<(TFirst First, TSecond Second)> Zip<TFirst,TSecond>(this System.Linq.IQueryable<TFirst> source1, System.Collections.Generic.IEnumerable<TSecond> source2);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")]
public static System.Linq.IQueryable<(TFirst First, TSecond Second)> Zip<TFirst,TSecond>(this System.Linq.IQueryable<TFirst> source1, System.Collections.Generic.IEnumerable<TSecond> source2);
static member Zip : System.Linq.IQueryable<'First> * seq<'Second> -> System.Linq.IQueryable<ValueTuple<'First, 'Second>>
[<System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")>]
static member Zip : System.Linq.IQueryable<'First> * seq<'Second> -> System.Linq.IQueryable<ValueTuple<'First, 'Second>>
<Extension()>
Public Function Zip(Of TFirst, TSecond) (source1 As IQueryable(Of TFirst), source2 As IEnumerable(Of TSecond)) As IQueryable(Of ValueTuple(Of TFirst, TSecond))

型パラメーター

TFirst

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

TSecond

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

パラメーター

source1
IQueryable<TFirst>

マージする最初のシーケンス。

source2
IEnumerable<TSecond>

マージする 2 番目のシーケンス。

戻り値

IQueryable<ValueTuple<TFirst,TSecond>>

最初のシーケンスと 2 番目のシーケンスから取得された要素を含むタプルのシーケンス。その順序です。

属性

適用対象