I have a 2d array, for which I want to get all possible combinations. But I'm getting stuck on how to do this. My data array looks like this:
var data = new string[][]
{
new string[] {"pa", "ga", "ka"},
new string[] {"pb", "gb", "kb"}
};
My expected output is something like this:
pa ga ka
pa ga kb
pa gb ka
pa gb kb
pb ga ka
pb ga kb
pb gb ka
pb gb kb
The order is also important. For example I can't make the combination ga pa ka. As the first item needs to start with p, second with g, and third with k. Therefore I can not use the cartesian product.
Note: In this example I have two rows. It could also be possible that I have more rows.