Lets say I have three list:
A = {"b", "c", "d", "x", "y", "z"}
B = {"a", "e", "i"}
I want to generate all combinations of selecting one element from both list.
For just 2 list this is easy (pseuodo-ish code):
combinations = []
for a in A:
for b in B:
combinations += [a, b]
But what if the number of lists is unknown? I want to generalize this somehow preferrably with a C# extension method.
The method signature would be something like this:
public static IEnumerable<IEnumerable<T>> Combination<T>(this IEnumerable<IEnumerable<T>> elements)
EDIT: I was looking for Cartesian product, thanks for clarification.