Skip to content

M_CSharpx_EnumerableExtensions_Cartesian__3

Moh.Hassan edited this page Oct 10, 2019 · 1 revision

EnumerableExtensions.Cartesian(TFirst, 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: CSharpx
Assembly: CommandLine (in CommandLine.dll) Version: 0.0.0

Syntax

C#

public static IEnumerable<TResult> Cartesian<TFirst, TSecond, TResult>(
	this IEnumerable<TFirst> first,
	IEnumerable<TSecond> second,
	Func<TFirst, TSecond, TResult> resultSelector
)

VB

<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)

C++

public:
[ExtensionAttribute]
generic<typename TFirst, typename TSecond, typename TResult>
static IEnumerable<TResult>^ Cartesian(
	IEnumerable<TFirst>^ first, 
	IEnumerable<TSecond>^ second, 
	Func<TFirst, TSecond, TResult>^ resultSelector
)

F#

[<ExtensionAttribute>]
static member Cartesian : 
        first : IEnumerable<'TFirst> * 
        second : IEnumerable<'TSecond> * 
        resultSelector : Func<'TFirst, 'TSecond, 'TResult> -> IEnumerable<'TResult> 

Parameters

 

first
Type: System.Collections.Generic.IEnumerable(TFirst)
second
Type: System.Collections.Generic.IEnumerable(TSecond)
resultSelector
Type: System.Func(TFirst, TSecond, TResult)

Type Parameters

 

TFirst
TSecond
TResult

Return Value

Type: IEnumerable(TResult)

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable(TFirst). 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

Reference

EnumerableExtensions Class
CSharpx Namespace

Clone this wiki locally