title: how to read xml attribute using C# classes using deserialization
body: <p>Below is My XML File :</p>
  
  <pre><code>&lt;Visibilities&gt;
      &lt;Visibilities AppName="Test2"&gt;
        &lt;Visibility DisplayName="Full Name"&gt;
          &lt;FullName&gt;
            &lt;FirstName PropertyName="FullName.FirstName" DisplayName="First Name" ListOrder="3"&gt;&lt;/FirstName&gt;
            &lt;MiddleName PropertyName="FullName.MiddleName" DisplayName="Middle Name" ListOrder="2"&gt;&lt;/MiddleName&gt;
            &lt;LastName PropertyName="FullName.LastName" DisplayName="Last Name" ListOrder="1"&gt;&lt;/LastName&gt;
          &lt;/FullName&gt;
        &lt;/Visibility&gt;
      &lt;/Visibilities&gt;
    &lt;/Visibilities&gt;
  </code></pre>
  
  <p>Below are my classes</p>
  
  <pre><code>#region FullName
      [Serializable]
      public class FullName
      {
          private String strFirstName;
          [XmlElement("FirstName")]
          public String FirstName
          {
              get { return strFirstName; }
              set { strFirstName = value; }
          }
  
          private String strMiddleName;
          [XmlElement("MiddleName")]
          public String MiddleName
          {
              get { return strMiddleName; }
              set { strMiddleName = value; }
          }
  
          private String strLastName;
          [XmlElement("LastName")]
          public String LastName
          {
              get { return strLastName; }
              set { strLastName = value; }
          }
  
          [XmlElement("ListOrder")]
          public int ListOrder { get; set; }
      }
      #endregion
  
      #region Visibility
      [Serializable]
      public class Visibility
      {
          public FullName FullName { get; set; }
  
          [XmlAttribute("DisplayName")]
          public String DisplayName { get; set; }
  
      }
      #endregion
  
      #region Visibilities
      [Serializable]
      public class Visibilities
      {
          [XmlAttribute("AppName")]
          public String AppName { get; set; }
  
          [XmlElement("Visibility")]
          public List&lt;Visibility&gt; Visibility { get; set; }
      }
      #endregion
  </code></pre>
  
  <p>Below Lines of codes is how I am reading :</p>
  
  <pre><code>foreach (Visibility vis in l.Visibility.ToList())
                  {
                      Console.WriteLine(vis.DisplayName);
                      Console.WriteLine("{0}{1}", vis.FullName.FirstName, Reflect.GetPropValue&lt;String&gt;(cust, vis.FullName.FirstName));
                  }
  </code></pre>
  
  <p>What Modifications I have to do so that I can read Attribute values i.e PropertyName,DisplayName,ListOrder from First,Middle,Last Name using classes or the readind code part?</p>