title: Convert xml to List by Deserialize in c#
body: <p>i have a xml file and i am trying to populate my list with the data through deserialization.</p>
  
  <h2>my xml is here</h2>
  
  <pre><code>&lt;?xml version="1.0" ?&gt;
  &lt;CustomerQueryRs&gt;
      &lt;CustomerRet&gt;
          &lt;ListID&gt;6BE0000-1159990808&lt;/ListID&gt;
          &lt;Name&gt;+ Blaine Bailey&lt;/Name&gt;
          &lt;FullName&gt;+ Blaine Bailey&lt;/FullName&gt;
          &lt;Phone&gt;866-855-0800&lt;/Phone&gt;
      &lt;/CustomerRet&gt;
      &lt;CustomerRet&gt;
          &lt;ListID&gt;9BA0000-1165353294&lt;/ListID&gt;
          &lt;Name&gt;+ Brian Boyd&lt;/Name&gt;
          &lt;FullName&gt;+ Brian Boyd&lt;/FullName&gt;
          &lt;Phone&gt;203-245-1877&lt;/Phone&gt;
      &lt;/CustomerRet&gt;
          &lt;CustomerRet&gt;
          &lt;ListID&gt;9280000-1164147562&lt;/ListID&gt;
          &lt;Name&gt;+ Brian Leahy&lt;/Name&gt;
          &lt;FullName&gt;+ Brian Leahy&lt;/FullName&gt;
          &lt;Phone&gt;508-341-0955&lt;/Phone&gt;
      &lt;/CustomerRet&gt;
  &lt;/CustomerQueryRs&gt;
  </code></pre>
  
  <p>here i am giving my full code. i just do not understand why my code is not working...what is missing in my code......it is not giving error but list is not getting populated. so please tell me which area i need to rectify in code.</p>
  
  <pre><code>[XmlTypeAttribute(AnonymousType = true)]
  public class CustomersData
  {
      [XmlArray(ElementName = "CustomerQueryRs")]
      [XmlArrayItem(ElementName = "CustomerRet")]
      public List&lt;Customer&gt; Customers { get; set; }
  
      public CustomersData()
      {
          Customers = new List&lt;Customer&gt;();
      }
  
  }
  
  public class Customer
  {
      [XmlElement(ElementName = "ListID")]
      public string ListID { get; set; }
  
      [XmlElement(ElementName = "Name")]
      public string Name { get; set; }
  
      [XmlElement(ElementName = "FullName")]
      public string FullName { get; set; }
  
      [XmlElement(ElementName = "Phone")]
      public string Phone { get; set; }
  }
  </code></pre>
  
  <h2>here is my desirialization code</h2>
  
  <pre><code>private object DeserialzeXml(string xml)
      {
          var xmlSer = new XmlSerializer(typeof(CustomersData), new XmlRootAttribute("CustomerQueryRs"));
          var stringReader = new StringReader(xml);
          return xmlSer.Deserialize(stringReader);
      }
  </code></pre>
  
  <p>please help......</p>