public override IEnumerable <IEnumerable <object> > GetEnumerableMember(int depth) { Console.WriteLine(new String('-', depth) + " AND " + Name); var combination = new List <IEnumerable <object> >(); foreach (var concat in Children) { var entries = new List <object>(); foreach (var elements in concat.GetEnumerableMember(depth + 2)) { entries.Add(elements); } combination.Add(entries); } var returns = Cartesian.CartesianProduct(combination); return(returns); }
static void linqy() { object[] letters = { new Leaf <int>("", 2), new Leaf <int>("", 6), new Leaf <int>("", 8) }; int[] numbers = { 1, 2, 3, 4 }; string[] colours = { "Red", "Blue" }; List <object[]> chilren = new List <object[]>(); chilren.Add(letters); object[] orConnected = { 'A', 'B', 'C', 1, 2, 3, 4 }; chilren.Add(orConnected); var cartesianProduct = Cartesian.CartesianProduct <object>(chilren); foreach (var x1 in cartesianProduct) { Console.WriteLine(JsonSerializer.Serialize(x1)); } }