title: DataContractSerializer stuck on WriteObject
body: <p>I have objects (woah!) which can serialise themselves using a <code>Serialise</code> method.
  I've tried multiple serialise methods, but all have been stuck on the <code>serialize.WriteObject</code> method. </p>
  
  <p>This is what my latest try looks like:</p>
  
  <pre><code>public string Serialise()
  {
      DataContractSerializer serializer = new DataContractSerializer(this.GetType());
      MemoryStream ms = new MemoryStream();
      serializer.WriteObject(ms, this);
      ms.Position = 0;
  
      string serializedContent;
      using(StreamReader sr = new StreamReader(ms))
      {
          serializedContent = sr.ReadToEnd();   
      }
      return serializedContent;
  }
  </code></pre>
  
  <p>I used to do this with a <code>XmlSerializer</code> and those didn't give me any trouble.
  I'm pretty sure I made my properties a <code>DataMember</code> and set up de <code>DataContract</code> of the class.</p>
  
  <p>What am I doing wrong here? Is it the way I want to use this Serialisation? Is it because I want to serialise inside the class with the DataContract? I'm baffled..</p>
  
  <p>------EDIT---------</p>
  
  <p>Ugh.. I figured out what the problem was... My BaseObject had no DataContract and no DataMembers on their properties (although i would not want any of those properties in my xml). So apparently making only a DataContract for the extended class is not enough to serialise it. </p>