I have multiple sets of arrays that contain additional arrays that have values attached that I use for figuring out math. In order to find the best combination of these things,
Assuming you are using a version of C# which supports LINQ:
static void Main(string[] args)
{
// declare some lists
var aList = new string[] { "a1", "a2", "a3" };
var bList = new string[] { "b1", "b2", "b3" };
var cList = new string[] { "c1", "c2", "c3" };
// do the equivalent of a SQL CROSS JOIN
var permutations = aList
.Join(bList, a => "", b => "", (a, b) => new string[] { a, b })
.Join(cList, ab => "", c => "", (ab, c) => new string[] { ab[0], ab[1], c });
// print the results
Console.WriteLine("Permutations:");
foreach (var p in permutations)
Console.WriteLine(string.Join(", ", p));
}
The Join calls with the lambda expressions pointing the strings to empty strings causes the Join function to treat the strings as equal, emulating a SQL CROSS JOIN.