title: Protobuf-net Runtime serialization
body: <pre><code>[ProtoContract]
  public abstract class Animal
  {
      [ProtoMember(1)]
      public abstract string Type { get; set; }
      [ProtoMember(2)]
      public string Name { get; set; }
      [ProtoMember(3)]
      public int Likeability { get; set; }
  }
  
  public class Cat : Animal
  {
      public override string Type { get; set; }
      public int Friendliness { get; set; }
  
      public override string ToString()
      {
          return String.Format("Type : {0}, Name : {1}, Likeability : {2}, Friendliness : {3}", Type, Name, Likeability, Friendliness);
      }
  }
  </code></pre>
  
  <p>use case i.e.</p>
  
  <pre><code>var animal = new Cat() { Name = "Whiskers", Friendliness = 10 , Type = "cat", Likeability = 5};
  var model = TypeModel.Create();
  model[typeof(Animal)].AddSubType(4, typeof(Cat));
  model[typeof(Cat)].AddField(1, "Friendliness");
  var typeModel = model.Compile();
  
  var memoryStream = new MemoryStream();
  typeModel.Serialize(memoryStream, animal);
  
  var deserializedCat = new Cat() { Name = "PusPus" };
  memoryStream.Seek(0, SeekOrigin.Begin);
  var deserializedCat1 = typeModel.Deserialize(memoryStream, deserializedCat, typeof(Cat));
  Console.WriteLine("deserializedCat : hash : " + deserializedCat.GetHashCode() + "\n" + deserializedCat);
  Console.WriteLine("deserializedCat1 : hash : " + deserializedCat1.GetHashCode() + "\n" + deserializedCat1);
  </code></pre>
  
  <p>Is the above use case correct for reusable runtime serialization or should one explicitly map the "Cat" ignoring the "Animal" and Also a bit confused w.r.t "ComplileInPlace" how does it differ from Compile ?</p>