[Solved] C# Dynamic for-loop


It can be done without recursion.

var s = "A,B,C|1,2|a|u,v,w";
var u = s.Split('|').Select(v => v.Split(',')).ToList();

var buffer = new List<string>();
buffer.Add("COMMAND ");
while (u.Count > 0)
{
    var t = from a in buffer
            from b in u.First()
            select a + ' ' + b;

    buffer = t.ToList();
    u.RemoveAt(0);
}

The buffer list will contain the “recursive outer join” combined strings afterwards.

2

solved C# Dynamic for-loop