title: C#: Object values null after deserializing XML
body: <p>I am trying to deserialize some XML returned in an API response but all the values in my object are NULL after deserializing.</p>
  
  <p>Below is the XML I am getting in the response that I am trying to deserialize.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ctatt&gt;
      &lt;tmst&gt;20160609 11:50:03&lt;/tmst&gt;
      &lt;errCd&gt;0&lt;/errCd&gt;
      &lt;errNm /&gt;
      &lt;eta&gt;
          &lt;staId&gt;41300&lt;/staId&gt;
          &lt;stpId&gt;30252&lt;/stpId&gt;
          &lt;staNm&gt;Loyola&lt;/staNm&gt;
          &lt;stpDe&gt;Service toward 95th/Dan Ryan&lt;/stpDe&gt;
          &lt;rn&gt;803&lt;/rn&gt;
          &lt;rt&gt;Red&lt;/rt&gt;
          &lt;destSt&gt;30089&lt;/destSt&gt;
          &lt;destNm&gt;95th/Dan Ryan&lt;/destNm&gt;
          &lt;trDr&gt;5&lt;/trDr&gt;
          &lt;prdt&gt;20160609 11:48:45&lt;/prdt&gt;
          &lt;arrT&gt;20160609 11:51:45&lt;/arrT&gt;
          &lt;isApp&gt;0&lt;/isApp&gt;
          &lt;isSch&gt;0&lt;/isSch&gt;
          &lt;isDly&gt;0&lt;/isDly&gt;
          &lt;isFlt&gt;0&lt;/isFlt&gt;
          &lt;flags /&gt;
          &lt;lat&gt;42.01906&lt;/lat&gt;
          &lt;lon&gt;-87.67289&lt;/lon&gt;
          &lt;heading&gt;130&lt;/heading&gt;
      &lt;/eta&gt;
  &lt;/ctatt&gt;
  </code></pre>
  
  <p>Here is my class:</p>
  
  <pre><code>[Serializable, XmlRoot("ctatt")]
          public class trainData
          {
              [XmlElement(ElementName ="tmst")]
              public string timeStamp { get; set; }
  
              [XmlElement(ElementName = "errCd")]
              public byte errorCode { get; set; }
  
              [XmlElement(ElementName = "staId")]
              public ushort stationId { get; set; }
  
              [XmlElement(ElementName = "stpId")]
              public ushort stopId { get; set; }
  
              [XmlElement(ElementName = "staNm")]
              public string stationName { get; set; }
  
              [XmlElement(ElementName = "stpDe")]
              public string stopDesc { get; set; }
  
              [XmlElement(ElementName = "rn")]
              public ushort runNum { get; set; }
  
              [XmlElement(ElementName = "rt")]
              public string routeName { get; set; }
  
              [XmlElement(ElementName = "destSt")]
              public ushort destStation { get; set; }
  
              [XmlElement(ElementName = "destNm")]
              public string destName { get; set; }
  
              [XmlElement(ElementName = "trDr")]
              public byte trainDir { get; set; }
  
              [XmlElement(ElementName = "prdt")]
              public string prdTime {get; set;}
  
              [XmlElement(ElementName = "arrT")]
              public string arrTime { get; set; }
  
              [XmlElement(ElementName = "isApp")]
              public ushort isApp { get; set; }
  
              [XmlElement(ElementName = "isSch")]
              public ushort isSch { get; set; }
  
              [XmlElement(ElementName = "isDly")]
              public ushort isDly { get; set; }
  
              [XmlElement(ElementName = "isFlt")]
              public ushort isFlt { get; set; }
  
              [XmlElement(ElementName = "flags")]
              public string flags { get; set; }
  
              [XmlElement(ElementName = "lat")]
              public double lat { get; set; }
  
              [XmlElement(ElementName = "lon")]
              public double lon { get; set; }
  
              [XmlElement(ElementName = "heading")]
              public ushort heading { get; set; }
          }
  </code></pre>
  
  <p>And here is the code I am using to deserialize:</p>
  
  <pre><code>var response = await client.GetAsync(urlParameters);
                  if (response.IsSuccessStatusCode)
                  {
                      var xml = await response.Content.ReadAsStringAsync();
                      XmlSerializer deserializer = new XmlSerializer(typeof(trainData));
                      using (StringReader reader = new StringReader(xml))
                      {
                          using (XmlReader xr = XmlReader.Create(reader))
                          {
                              trainData result = (trainData)deserializer.Deserialize(xr);
                              Console.WriteLine("Station Name: {0}\nRoute Name: {1}\nArrival Time: {2}", result.stationName, result.routeName, result.arrTime);
                          }
                      }
                  }
                  else
                  {
                      Console.WriteLine("There was an error!");
                  }
  </code></pre>
  
  <p>Any suggestions would be greatly appreciated...</p>