title: Unable to serialize an object
body: <p>Below is the code that I am using to serialize an object</p>
  
  <pre><code>College college = new College();
  college= (College)(Session["XML"]);
  
  public void serializetoxml(College college)
  {
      System.Xml.Serialization.XmlSerializer myserializer = new System.Xml.Serialization.XmlSerializer(college.GetType());
      // XmlSerializer myserializer = new XmlSerializer(typeof(College));
      TextWriter mywriter = new StreamWriter("C:\\invoice.xml");
      myserializer.Serialize(mywriter, college);
      mywriter.Close();
  } 
  </code></pre>
  
  <p>Sorry , I missed to paste the code for my class, here it is </p>
  
  <pre><code>[System.SerializableAttribute()]
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="")]           [System.Xml.Serialization.XmlRootAttribute]
  public partial class College{
  
      /// &lt;remarks/&gt;
      public Header header;
  
      /// &lt;remarks/&gt;
      [System.Xml.Serialization.XmlElementAttribute("Student")]
      public Student Student;
  
      /// &lt;remarks/&gt;
      public Summary summary;
  }
  
  [System.SerializableAttribute()]
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true,Namespace="")] 
  [System.Xml.Serialization.XmlRootAttribute]
  public partial class Invoice {
  
  
      /// &lt;remarks/&gt;
      [System.Xml.Serialization.XmlElementAttribute("Activity")]
  
      public List&lt;Activity&gt; Activity;
  
          }
  [System.SerializableAttribute()]
  [System.Diagnostics.DebuggerStepThroughAttribute()]
  [System.ComponentModel.DesignerCategoryAttribute("code")]
  [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="")]
  [System.Xml.Serialization.XmlRootAttribute(Namespace="", IsNullable=false)]
  public partial class Activity{
  
      /// &lt;remarks/&gt;
      [System.Xml.Serialization.XmlElementAttribute(DataType = "integer")]
      public string StudentNumber;
  
  
      /// &lt;remarks/&gt;        
      public string mark1;
  
      ///  &lt;remarks/&gt; typed it in manually
  
      public string mark2;
     }
  </code></pre>
  
  <p>This is the error that I am getting {"There was an error reflecting type 'A.Common.College'."}</p>
  
  <p>It is an example of realtimeclass.</p>