title: Deserializing xml to object with dictionary
body: <p>This is my class structure:</p>
  
  <pre><code>class DataItem
  {
     public string Id { get; set; }
     public string Type { get; set; }
  
     private Dictionary&lt;string, DataProperty&gt; properties = new Dictionary&lt;string, DataProperty&gt;();
  
     public Dictionary&lt;string, DataProperty&gt; Properties
     {
         get { return properties; }
         set { properties = value; }
     }
  }
  
  public class DataProperty
  {    
        public string Key { get; set; }
        public string Value { get; set; }
        public bool Required { get; set; }
  }
  </code></pre>
  
  <p>This is XML I want to use (<strong>NOTE: I can change the xml if needed</strong>):   </p>
  
  <pre><code>&lt;Data&gt;
    &lt;DataItem&gt;
      &lt;id&gt;ph15&lt;/id&gt;
      &lt;type&gt;core&lt;/type&gt;
      &lt;properties&gt;
        &lt;DataProperty&gt;
          &lt;key&gt;size&lt;/key&gt;
          &lt;value&gt;50%&lt;/value&gt;
          &lt;required&gt;false&lt;/required&gt;
        &lt;/DataProperty&gt;
        &lt;DataProperty&gt;
          &lt;key&gt;color&lt;/key&gt;
          &lt;value&gt;red&lt;/value&gt;
          &lt;required&gt;true&lt;/required&gt;
        &lt;/DataProperty&gt;
      &lt;/properties&gt;
    &lt;/DataItem&gt;
    &lt;DataItem&gt;
      &lt;id&gt;ph234&lt;/id&gt;
      &lt;type&gt;core&lt;/type&gt;
      &lt;properties&gt;
      &lt;/properties&gt;
    &lt;/DataItem&gt;
  &lt;/Data&gt;
  </code></pre>
  
  <p>Eventually XML should be loaded into another dictionary:  </p>
  
  <pre><code>private Dictionary&lt;string, DataItem&gt; Mydata;
  </code></pre>