title: Serialize Object
body: <p>I am new to serialization and I cannot for the life of me figure out how to fix this exception I am getting...</p>
  
  <p>I have an object that has the following structure</p>
  
  <pre><code>[XmlRoot("MaxCut2")]
  public class MaxCut2File : IFile
  {
      public MaxCut2File()
      {
          MyJob = new Job();
          Job.Reference = "MyRef";
      }
  
      [XmlElement("JobDetails", typeof(Job))]
      public IJob MyJob
      {
          get;
          set;
      }    
  }
  </code></pre>
  
  <p>An inteferface...</p>
  
  <pre><code>   public interface IJob
      {        
          string Reference { get; set; }
      }
  </code></pre>
  
  <p>And an class</p>
  
  <pre><code>[Serializable()]
  public class Job : IJob
  {
      [XmlElement("Reference")]
      public string Reference { get; set; }
  }
  </code></pre>
  
  <p>When I try to serialize an instance of the MaxCut2File object I get an error </p>
  
  <p>{"Cannot serialize member 'MaxCut2File.MaxCut2File.MyJob' of type 'MaxCut2BL.Interfaces.IJob', see inner exception for more details."}
  "There was an error reflecting type 'MaxCut2File.MaxCut2File'."</p>
  
  <p>However if I change my property MyJob from the IJob type to the Job type it works fine...</p>
  
  <p>Any ideas?</p>