MoreEnumerableCartesianTFirst, TSecond, TResult Method |
Returns the Cartesian product of two sequences by combining each element of the first set with each in the second
and applying the user=define projection to the pair.
Namespace:
MoreLinq
Assembly:
MoreLinq (in MoreLinq.dll) Version: 2.4.0
Syntax public static IEnumerable<TResult> Cartesian<TFirst, TSecond, TResult>(
this IEnumerable<TFirst> first,
IEnumerable<TSecond> second,
Func<TFirst, TSecond, TResult> resultSelector
)
<ExtensionAttribute>
Public Shared Function Cartesian(Of TFirst, TSecond, TResult) (
first As IEnumerable(Of TFirst),
second As IEnumerable(Of TSecond),
resultSelector As Func(Of TFirst, TSecond, TResult)
) As IEnumerable(Of TResult)
public:
[ExtensionAttribute]
generic<typename TFirst, typename TSecond, typename TResult>
static IEnumerable<TResult>^ Cartesian(
IEnumerable<TFirst>^ first,
IEnumerable<TSecond>^ second,
Func<TFirst, TSecond, TResult>^ resultSelector
)
[<ExtensionAttribute>]
static member Cartesian :
first : IEnumerable<'TFirst> *
second : IEnumerable<'TSecond> *
resultSelector : Func<'TFirst, 'TSecond, 'TResult> -> IEnumerable<'TResult>
Parameters
- first
- Type: System.Collections.GenericIEnumerableTFirst
The first sequence of elements - second
- Type: System.Collections.GenericIEnumerableTSecond
The second sequence of elements - resultSelector
- Type: SystemFuncTFirst, TSecond, TResult
A projection function that combines elements from both sequences
Type Parameters
- TFirst
- The type of the elements of first
- TSecond
- The type of the elements of second
- TResult
- The type of the elements of the result sequence
Return Value
Type:
IEnumerableTResultA sequence representing the Cartesian product of the two source sequences
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableTFirst. 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).
See Also