title: how to serialize a property property only not the whole property using xml attributes?
body: <p>I want to serialize an object that contains properties and one of these properties I want only to serialize its name. </p>
  
  <p>How to do this without implmeneting <code>IXmlSerializable</code> interface, only using attributes.</p>
  
  <pre><code>[Serializable]
  public class Class
  {
      public Class()
      {
      }
  
      [XmlAttribute]
      public string ClassId{get;set;}
  
      [XmlAttribute]
      public Teacher Teacher{get;set;}
  
      [XmlArray("Students")]
      [XmlArrayItem("Student", Type=typeof(Student))]
      public List&lt;Student&gt; Students { get; } = new List&lt;Student&gt;();
  }
  
  
  [Serializable]
  public class Student 
  {
      public Student()
      {
  
      }
  
      public Class CurrentClass{get;set;}
  
  
      [XmlAttribute]
      public string Name { get; set; } = "New Student";
  
      [XmlAttribute]
      public int Age { get; set; } = 10;
  
  }
  </code></pre>
  
  <p><code>CurrentClass</code> this property I don't want to ignore it.</p>
  
  <p>I want to serialize only its <code>CurrentClass.ClassId</code> value.</p>