Click or drag to resize
AlgorithmsCartesianProductTFirst, TSecond Method
Computes the cartestian product of two collections: all possible pairs of items, with the first item taken from the first collection and the second item taken from the second collection. If the first collection has N items, and the second collection has M items, the cartesian product will have N * M pairs.

Namespace: X3Platform.Collections
Assembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntax
public static IEnumerable<Pair<TFirst, TSecond>> CartesianProduct<TFirst, TSecond>(
	IEnumerable<TFirst> first,
	IEnumerable<TSecond> second
)

Parameters

first
Type: System.Collections.GenericIEnumerableTFirst
The first collection.
second
Type: System.Collections.GenericIEnumerableTSecond
The second collection.

Type Parameters

TFirst
The type of items in the first collection.
TSecond
The type of items in the second collection.

Return Value

Type: IEnumerablePairTFirst, TSecond
An IEnumerable<Pair<TFirst, TSecond>> that enumerates the cartesian product of the two collections.
See Also