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.CollectionsAssembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntaxpublic static IEnumerable<Pair<TFirst, TSecond>> CartesianProduct<TFirst, TSecond>(
IEnumerable<TFirst> first,
IEnumerable<TSecond> second
)
public:
generic<typename TFirst, typename TSecond>
static IEnumerable<Pair<TFirst, TSecond>>^ CartesianProduct(
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,
TSecondAn IEnumerable<Pair<TFirst, TSecond>> that enumerates the cartesian product of the two collections.
See Also