MoreEnumerableCartesianT1, T2, T3, T4, T5, T6, T7, T8, TResult Method (IEnumerableT1, IEnumerableT2, IEnumerableT3, IEnumerableT4, IEnumerableT5, IEnumerableT6, IEnumerableT7, IEnumerableT8, FuncT1, T2, T3, T4, T5, T6, T7, T8, TResult) |
Returns the Cartesian product of eight sequences by enumerating all
possible combinations of one item from each sequence, and applying
a user-defined projection to the items in a given combination.
Namespace:
MoreLinq
Assembly:
MoreLinq (in MoreLinq.dll) Version: 3.0.0
Syntax public static IEnumerable<TResult> Cartesian<T1, T2, T3, T4, T5, T6, T7, T8, TResult>(
this IEnumerable<T1> first,
IEnumerable<T2> second,
IEnumerable<T3> third,
IEnumerable<T4> fourth,
IEnumerable<T5> fifth,
IEnumerable<T6> sixth,
IEnumerable<T7> seventh,
IEnumerable<T8> eighth,
Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult> resultSelector
)
<ExtensionAttribute>
Public Shared Function Cartesian(Of T1, T2, T3, T4, T5, T6, T7, T8, TResult) (
first As IEnumerable(Of T1),
second As IEnumerable(Of T2),
third As IEnumerable(Of T3),
fourth As IEnumerable(Of T4),
fifth As IEnumerable(Of T5),
sixth As IEnumerable(Of T6),
seventh As IEnumerable(Of T7),
eighth As IEnumerable(Of T8),
resultSelector As Func(Of T1, T2, T3, T4, T5, T6, T7, T8, TResult)
) As IEnumerable(Of TResult)
public:
[ExtensionAttribute]
generic<typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename TResult>
static IEnumerable<TResult>^ Cartesian(
IEnumerable<T1>^ first,
IEnumerable<T2>^ second,
IEnumerable<T3>^ third,
IEnumerable<T4>^ fourth,
IEnumerable<T5>^ fifth,
IEnumerable<T6>^ sixth,
IEnumerable<T7>^ seventh,
IEnumerable<T8>^ eighth,
Func<T1, T2, T3, T4, T5, T6, T7, T8, TResult>^ resultSelector
)
[<ExtensionAttribute>]
static member Cartesian :
first : IEnumerable<'T1> *
second : IEnumerable<'T2> *
third : IEnumerable<'T3> *
fourth : IEnumerable<'T4> *
fifth : IEnumerable<'T5> *
sixth : IEnumerable<'T6> *
seventh : IEnumerable<'T7> *
eighth : IEnumerable<'T8> *
resultSelector : Func<'T1, 'T2, 'T3, 'T4, 'T5, 'T6, 'T7, 'T8, 'TResult> -> IEnumerable<'TResult>
Parameters
- first
- Type: System.Collections.GenericIEnumerableT1
The first sequence of elements. - second
- Type: System.Collections.GenericIEnumerableT2
The second sequence of elements. - third
- Type: System.Collections.GenericIEnumerableT3
The third sequence of elements. - fourth
- Type: System.Collections.GenericIEnumerableT4
The fourth sequence of elements. - fifth
- Type: System.Collections.GenericIEnumerableT5
The fifth sequence of elements. - sixth
- Type: System.Collections.GenericIEnumerableT6
The sixth sequence of elements. - seventh
- Type: System.Collections.GenericIEnumerableT7
The seventh sequence of elements. - eighth
- Type: System.Collections.GenericIEnumerableT8
The eighth sequence of elements. - resultSelector
- Type: SystemFuncT1, T2, T3, T4, T5, T6, T7, T8, TResult
A projection function that combines
elements from all of the sequences.
Type Parameters
- T1
-
The type of the elements of first.
- T2
-
The type of the elements of second.
- T3
-
The type of the elements of third.
- T4
-
The type of the elements of fourth.
- T5
-
The type of the elements of fifth.
- T6
-
The type of the elements of sixth.
- T7
-
The type of the elements of seventh.
- T8
-
The type of the elements of eighth.
- TResult
-
The type of the elements of the result sequence.
Return Value
Type:
IEnumerableTResultA sequence of elements returned by
resultSelector.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableT1. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Remarks
The method returns items in the same order as a nested foreach
loop, but all sequences except for first are
cached when iterated over. The cache is then re-used for any
subsequent iterations.
This method uses deferred execution and stream its results.
See Also