title: Converting a List<> to an Array - I get "Attempted to access an element as a type incompatible with the array."
body: <p>I'm trying to walk through a bunch of items, each item has an array of List&lt;> objects that I want to convert to an array of arrays..  Here's the code to do that:</p>
  
  <pre><code>foreach (IngredientNode i in _snapshot._ingredientMap.Values)
  {
     for (int c = 0; c &lt; NUM_TAGS; c++)
     {
        if (i.RecipesByTag[c] == null) continue;
        i.RecipesByTag[c] = i.RecipesByTag[c].ToArray&lt;RecipeNode&gt;();
     } &lt;--- EXCEPTION
  }
  </code></pre>
  
  <p>RecipesByTag has a static type of <code>IEnumerable&lt;RecipeNode&gt;[]</code>.  However, its dynamic type is <code>List&lt;RecipeNode&gt;[]</code>.  I want to go through each one of those and convert the dynamic type of RecopeNode[].  Under the debugger, this works and i.RecipesByTag gets converted.  However, the last curly brace then throws the exception:</p>
  
  <p>Attempted to access an element as a type incompatible with the array.</p>
  
  <p>I have a feeling there's some sort of stack corruption going on.  Can someone explain what's happening at a technical level here?  Thanks!</p>
  
  <p>Mike</p>