title: Deserializing XML to C# Object returning null values
body: <p>When trying to get the values ​​from the XML text that comes from a WebService, the values ​​are null as the image below.</p>
  <h3>Code</h3>
  <pre><code>string texto = 
      &quot;&lt;?xml version=\&quot;1.0\&quot;?&gt;&quot; + 
      &quot;&lt;EnviarLoteRpsResposta xmlns:xsd=\&quot;http://www.w3.org/2001/XMLSchema\&quot; xmlns:xsi=\&quot;http://www.w3.org/2001/XMLSchema-instance\&quot;&gt;&quot;+
      &quot;   &lt;NumeroLote&gt;3774&lt;/NumeroLote&gt;&quot; +
      &quot;   &lt;DataRecebimento&gt;2014-09-03T23:03:57.3428675-03:00&lt;/DataRecebimento&gt;&quot; +
      &quot;   &lt;Protocolo&gt;635453822373428675&lt;/Protocolo&gt;&quot; +
      &quot;&lt;/EnviarLoteRpsResposta&gt;&quot;;
              
  XmlRootAttribute rootAttribute = new XmlRootAttribute(&quot;EnviarLoteRpsResposta&quot;);
  XmlSerializer serializer = new XmlSerializer(typeof(WS.NF.EnviarLoteRpsResposta), rootAttribute);
  WS.NF.EnviarLoteRpsResposta ei = (WS.NF.EnviarLoteRpsResposta)serializer.Deserialize(new StringReader(texto)); 
  </code></pre>
  <h3>Return variabble <code>ei</code></h3>
  <p><img src="https://i.stack.imgur.com/Llrrk.png" alt="enter image description here" /></p>
  <h3>Edit</h3>
  <p>From what I saw, the return is not the <code>ListaMensagemRetorno</code> field. Is this the problem?</p>
  <h3>Service Reference</h3>
  <pre><code>[System.CodeDom.Compiler.GeneratedCodeAttribute(&quot;System.Xml&quot;, &quot;4.0.30319.33440&quot;)]
  [System.SerializableAttribute()]
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute(&quot;code&quot;)]
  [System.Xml.Serialization.XmlTypeAttribute(Namespace=&quot;http://www.e-governeapps2.com.br/&quot;)]
  public partial class EnviarLoteRpsResposta {
          
      private System.Nullable&lt;ulong&gt; numeroLoteField;
          
      private System.Nullable&lt;System.DateTime&gt; dataRecebimentoField;
          
      private string protocoloField;
          
      private MensagemRetorno[] listaMensagemRetornoField;
          
      /// &lt;remarks/&gt;
      [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
      public System.Nullable&lt;ulong&gt; NumeroLote {
          get {
              return this.numeroLoteField;
          }
          set {
              this.numeroLoteField = value;
          }
      }
          
      /// &lt;remarks/&gt;
      [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
      public System.Nullable&lt;System.DateTime&gt; DataRecebimento {
          get {
              return this.dataRecebimentoField;
          }
          set {
              this.dataRecebimentoField = value;
          }
      }
          
      /// &lt;remarks/&gt;
      public string Protocolo {
          get {
              return this.protocoloField;
          }
          set {
              this.protocoloField = value;
          }
      }
          
      /// &lt;remarks/&gt;
      public MensagemRetorno[] ListaMensagemRetorno {
          get {
              return this.listaMensagemRetornoField;
          }
          set {
              this.listaMensagemRetornoField = value;
          }
      }
  }
  </code></pre>