Good - I’m not even sure that this term is right, and I’m sure that there is a certain term for this, but I will do my best to explain it. This is not a cross-product, and the order of the results is absolutely important.
Given:
IEnumerable<IEnumerable<string>> sets =
new[] {
new[] { "a", "b", "c" },
new[] { "1", "2", "3" },
new[] { "x", "y", "z" }
};
If each internal enumeration is a command to create a set of concatenations as follows (meaning is important here):
set a* = new string[] { "abc", "ab", "a" };
set b* = new string[] { "123", "12", "1" };
set c* = new string[] { "xyz", "xy", "x" };
I want to create the specified ordered concatenations as follows:
set final = new string { a*[0] + b*[0] + c*[0],
a*[0] + b*[0] + c*[1],
a*[0] + b*[0] + c*[2],
a*[0] + b*[0],
a*[0] + b*[1] + c*[0],
a*[0] + b*[1] + c*[1],
a*[0] + b*[1] + c*[2],
a*[0] + b*[1],
a*[0] + b*[2] + c*[0],
a*[0] + b*[2] + c*[1],
a*[0] + b*[2] + c*[2],
a*[0] + b*[2],
a*[0],
a*[1] + b*[0] + c*[0],
a*[2] + b*[0] + c*[0],
b*[0] + c*[0],
c[0],
c[1],
c[2]};
It’s so clear that there will be many combinations!
I see similarities with numerical fundamentals (since order is also important), and I'm sure there are permutations / combinations here.
The question is how to write such an algorithm that can cope with any number of rowsets. Linq, not Linq; I did not fuss.
Why am I doing this?
In fact, why !?
Asp.Net MVC - , . View View-en-GB, View-en, View-GB View (, , / , - a Distinct() ).
, , ( , - , , !).
, , ( , ), .
, .
, . !
.