title: Multidimensional Associate Array in C#
body: <p>I am completely new to C#. I am a PHP programmer. So please bear with me.</p>
  
  <p>I have an XML with the following in it:</p>
  
  <pre><code>&lt;setting name="event1" color="white" align="center" /&gt;
  &lt;setting name="event2" color="red" align="left" /&gt;
  </code></pre>
  
  <p>I have already figured out how to get the information, using XmlReader GetAttribute, but I have absolutely no idea how to store it into an array. The final array I would like to have would be something like this:</p>
  
  <pre><code>Array
  (
      [event1] =&gt; Array
      (
          [color] =&gt; white
          [align] =&gt; center
      )
      [event2] =&gt; Array
      (
          [color] =&gt; red
          [align] =&gt; left
      )
  )
  </code></pre>
  
  <p>So if I wanted to access the information from an array called "settings", I would use:</p>
  
  <pre><code>settings["event1"]["color"] = "white";
  </code></pre>
  
  <p>How would I do something like this in C#? Bear in mind I am completely new to C#.</p>
  
  <p>----- EDIT</p>
  
  <p>I have tried adding a class:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  
  namespace xSplit_Panel_Writer
  {
      class Settings
      {
          public string Color { get; set; }
          public string Align { get; set; }
      }
  }
  </code></pre>
  
  <p>But I am having issues getting it working in my actual script...</p>
  
  <pre><code>        using (XmlReader reader = XmlReader.Create("data/config.xml"))
          {
              while (reader.Read())
              {
                  if ((reader.NodeType == XmlNodeType.Element) &amp;&amp; (reader.Name == "setting"))
                  {
                      var settings = new Dictionary&lt;string, Settings&gt;();
                      settings.Add(reader.Name, reader);
                  }
              }
          }
  </code></pre>
  
  <p>I am getting the following errors:</p>
  
  <pre><code>Error   1   The best overloaded method match for 'System.Collections.Generic.Dictionary&lt;string,xSplit_Panel_Writer.Settings&gt;.Add(string, xSplit_Panel_Writer.Settings)' has some invalid arguments  C:\Users\Jaxel\documents\visual studio 2010\Projects\xSplit Panel Writer\xSplit Panel Writer\MainForm.cs    31  25  xSplit Panel Writer
  Error   2   Argument 2: cannot convert from 'System.Xml.XmlReader' to 'xSplit_Panel_Writer.Settings'    C:\Users\Jaxel\documents\visual studio 2010\Projects\xSplit Panel Writer\xSplit Panel Writer\MainForm.cs    31  51  xSplit Panel Writer
  </code></pre>