title: C# Permutation of an array of arraylists?
body: <p>I have an ArrayList[] myList and I am trying to create a list of all the permutations of the values in the arrays.</p>
  
  <p>EXAMPLE: (all values are strings)</p>
  
  <pre><code>myList[0] = { "1", "5", "3", "9" };
  myList[1] = { "2", "3" };
  myList[2] = { "93" };
  </code></pre>
  
  <p>The count of myList can be varied so its length is not known beforehand. </p>
  
  <p>I would like to be able to generate a list of all the permutations similar to the following (but with some additional formatting).</p>
  
  <pre><code>1 2 93
  1 3 93
  5 2 93
  5 3 93
  3 2 93
  3 3 93
  9 2 93
  9 3 93
  </code></pre>
  
  <p>Does this make sense of what I am trying to accomplish?  I can't seem to come up with a good method for doing this, (if any).</p>
  
  <p>Edit:<br>
  I am not sure if recursion would interfere with my desire to format the output in my own manner. Sorry I did not mention before what my formatting was.</p>
  
  <p>I want to end up building a string[] array of all the combinations that follows the format like below:</p>
  
  <p>for the "1 2 93" permutation</p>
  
  <p>I want the output to be "val0=1;val1=2;val2=93;"</p>
  
  <p>I will experiment with recursion for now. Thank you DrJokepu</p>