title: Deserialize XML to object in C# XmlRoot is not working
body: <p>I am using asp.net (C#) website, I want to <code>Deserialize</code> the <code>XML</code> string using <code>XmlSerializer</code> class. </p>
  
  <p><strong>My Model (.cs file)</strong></p>
  
  <pre><code>[XmlRoot("MedicalClearanceFormRoot")]
    public class MedicalClearanceViewModel
    {
  
  
      [XmlAttribute("PassengerName")]
      public string PassengerName { get; set; }
  
      [XmlAttribute("Gender")]
      public string Gender { get; set; }
  
      [XmlAttribute("Age")]
      public string Age { get; set; }
  
      [XmlAttribute("PhoneNo")]
      public string PhoneNo { get; set; }
  
      [XmlAttribute("Email")]
      public string Email { get; set; }
  
      [XmlAttribute("BookingRefNo")]
      public string BookingRefNo { get; set; } 
  }
  </code></pre>
  
  <p><strong>XML String</strong></p>
  
  <pre><code>&lt;MedicalClearanceFormRoot&gt;
    &lt;MedicalClearanceForm PassengerName="AAAAAAAAAAAAA" Age="11" PhoneNo="TTTTTTTTTTT" Email="ZZZZZZZZZZZZZZZZZZZ" BookingRefNo="11111111111111111111" /&gt;  
  &lt;/MedicalClearanceFormRoot&gt;
  </code></pre>
  
  <p><strong>Code to De-Serialize the XML to Object</strong></p>
  
  <pre><code>string myXMLStringFromDB = GetXMLStringFromDb(); // this method will return XML from db.
  
      XmlSerializer serializer = new XmlSerializer(typeof(MedicalClearanceViewModel));
                using (TextReader reader = new StringReader(myXMLStringFromDB))
                {
                 MedicalClearanceViewModel objModel = (MedicalClearanceViewModel)serializer.Deserialize(reader);
                }
  </code></pre>
  
  <p>But, the issue is when I De-serialize the XML to object using above code ... the properties like <code>PassengerName</code>, <code>Age</code>, <code>PhoneNo</code> Etc. are still blank in <code>objModel</code></p>
  
  <p>Can someone can help me to set the proper XML Notations on my Class on can someone can help  me to resolve this issue .</p>
  
  <p>Any help will be highly appreciated !
  Thanks </p>