title: Trouble deserializing an XML file which has only one node; the root node
body: <p>This is the XML file I'm trying to deserialize:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;d:MyItem xmlns:d="http://someurl" xmlns:m="http://someotherurl"&gt;This is a string&lt;/d:MyItem&gt;
  </code></pre>
  
  <p>The <a href="https://stackoverflow.com/a/364410/44084">xsd tool</a> generated the following class:</p>
  
  <pre><code>[System.CodeDom.Compiler.GeneratedCodeAttribute("xsd", "4.0.30319.1")]
  [System.SerializableAttribute()]
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://someurl")]
  [System.Xml.Serialization.XmlRootAttribute(Namespace="http://someurl", IsNullable=false)]
  public partial class MyItem {
  
      private object[] itemsField;
  
      /// &lt;remarks/&gt;
      public object[] Items {
          get {
              return this.itemsField;
          }
          set {
              this.itemsField = value;
          }
      }
  }
  </code></pre>
  
  <p>I'm currently trying to deserialize the same xml that <code>xsd</code> used to generate the class:</p>
  
  <pre><code>var xml = "&lt;?xml version=\"1.0\" encoding=\"utf-8\"?&gt;\r\n&lt;d:MyItem xmlns:d=\"http://someurl\" xmlns:m=\"http://someotherurl\"&gt;This is a string&lt;/d:MyItem&gt;";
  var deserialized = Deserialize&lt;MyItem&gt;(xml);
  </code></pre>
  
  <p>Where <code>Deserialize&lt;&gt;</code> is:</p>
  
  <pre><code>private static T Deserialize&lt;T&gt;(string xml)
  {
      var xmlDocument = XDocument.Parse(xml);
      var serializer = new System.Xml.Serialization.XmlSerializer(typeof(T));
      return (T)serializer.Deserialize(xmlDocument.CreateReader());
  }
  </code></pre>
  
  <p>The problem is that although <code>Deserialize</code> returns an instance (not null), the <code>Items</code> property inside it is <code>null</code> i.e. it's not being deserialized. </p>
  
  <p>How am I able to get the string from inside this XML?</p>