title: An Array of Dictionary in C# - Possible?
body: <p>Can I use an Array of Dictionary objects?</p>
  
  <p>I have an XML which I would like to modify. The Data Structure that I am to use is this - </p>
  
  <pre><code>Dictionary&lt;element, Dictionary&lt;attr, value&gt;&gt;
  </code></pre>
  
  <p>element - is the Element which I am about to modify
  attr - the attribute whose value I am going to update
  value - the value with which I am to update</p>
  
  <pre><code>&lt;Parents&gt;
      &lt;Parent id="ParentA" description="New"&gt;
          &lt;Children&gt;
              &lt;Child name="ChildA" /&gt;
          &lt;/Children&gt;
      &lt;/Parent&gt;
  &lt;/Parents&gt;
  </code></pre>
  
  <p>I would want to pass the following</p>
  
  <pre><code>Dictionary&lt;string, string&gt; dict_Attributes1=new Dictionary&lt;string, string&gt;();
  Dictionary&lt;string, string&gt; dict_Attributes2=new Dictionary&lt;string, string&gt;();
  dict_Attributes1.Add("id", "ParentB");
  dict_Attributes1.Add("description", "Old");
  dict_Attributes2.Add("name", "ChildB");
  Dictionary&lt;string, Dictionary&lt;string, string&gt;&gt; dict_Elements = new Dictionary&lt;string, Dictionary&lt;string, string&gt;&gt;();
  dict_Elements.Add(".", dict_Attributes1);//To update the Element
  dict_Elements.Add("Children/Child", dict_Attributes2);//To update the Children's Attributes
  </code></pre>
  
  <p>Let us assume that I have already identified that I am to update Parent whose id is ParentA. </p>
  
  <p>Now, here I am creating dict_Attributes1, dict_Attributes2 etc., is there a way I can have them stored in an (dynamic, size unknown at compile time) Array of Dictionary objects?</p>
  
  <p>Alternatively, is there a better way of doing this - 
  1. Modify the attributes of a Selected XElement and its children's attributes?</p>
  
  <p><em>EDIT</em></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Configuration&gt;
      &lt;Environments&gt;
          &lt;Environment id="Master" description="MasterSystem"&gt;
              &lt;Systems&gt;
                  &lt;DefaultSystem systemName="Master" server="http://localhost" /&gt;
              &lt;/Systems&gt;
          &lt;/Environment&gt;
      &lt;/Environments&gt;
  &lt;/Configuration&gt;
  </code></pre>
  
  <p>Now, when a user changes the id and description, I want to update this XML file with the new values. While changing the id and description (which are obtained from the user), I want to update the systemName as well with the same value of id. </p>
  
  <p>If the new id is "Development" and description is "DevelopmentSystem", </p>
  
  <p>The output XML should be </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;Configuration&gt;
      &lt;Environments&gt;
          &lt;Environment id="Development" description="DeveloperSystem"&gt;
              &lt;Systems&gt;
                  &lt;DefaultSystem systemName="Development" server="http://localhost" /&gt;
              &lt;/Systems&gt;
          &lt;/Environment&gt;
      &lt;/Environments&gt;
  &lt;/Configuration&gt;
  </code></pre>