title: Polymorphism not working on collections elements using MessagePack-Csharp nuget
body: <p>I'm not being able to deserialize a collection of elements where the instances have a Inheritance relationship between them. </p>
  
  <p>Does anyone came across this issue?</p>
  
  <p>So my use case is this: 
  My model is similiar to this: </p>
  
  <pre><code>[DataContract]
      public class Item
      {
          [DataMember]
          public int Id { get; set; }
  
          [DataMember]
          public string Name { get; set; }
  
          [DataMember]
          public bool Valid { get; set; }
  
  
      }
  
      [DataContract]
      public class IntermediateItem : Item
      {
          [DataMember]
          public int Priority { get; set; }
      }
  
      [DataContract]
      public class ExtendedItem : IntermediateItem
      {
          [DataMember]
          public int Count { get; set; }
  
          [DataMember]
          public ItemsCollection Childs { get; set; }
      }
  </code></pre>
  
  <p>And Items Collection is something like this:</p>
  
  <pre><code> [DataContract]
      public class ItemsCollection : Collection&lt;Item&gt;
      {
       }
  </code></pre>
  
  <p>The setup that I have made to ensure the proper deserialization is: 
  Defining the CollectionFormatterBase:</p>
  
  <pre><code> public class ItemCollectionFormatterBase : CollectionFormatterBase&lt;Item, ItemsCollection&gt;
      {
          protected override ItemsCollection Create(int count)
          {
              return new ItemsCollection();
          }
  
          protected override void Add(ItemsCollection collection, int index, Item value)
          {
              collection.Add(value);
          }
      }
  </code></pre>
  
  <p>The example that is not working, and not working I mean, the deserialized instances are all of base type, some how the inheritance relationship got lost in the serialization.</p>
  
  <p>Example: </p>
  
  <pre><code>   MessagePack.Resolvers.CompositeResolver.RegisterAndSetAsDefault(new[] { new ItemCollectionFormatterBase() }, new[] { StandardResolver.Instance });
  
  
  ExtendedItem instance = new ExtendedItem()
              {
                  Id = 1,
                  Name = "Extended Item",
                  Priority = 121,
                  Valid = true,
                  Count = 10,
                  Childs = new ItemsCollection(new List&lt;Item&gt;() { new Item() { Id = 1 }, new IntermediateItem() { Priority = 10 }, new ExtendedItem() { Count = 10 } })
  
              };
  
   byte[] bytes  = MessagePackSerializer.Serialize(instance);
  
            using (FileStream file = new FileStream(this.filePath.AbsolutePath, FileMode.Create))
              {
                  await file.WriteAsync(bytes  , 0, payload.Length);
                  await file.FlushAsync();
              }
  
    using (FileStream file = new FileStream(testsFolder + @"\ExtendedItem.msgPack-csharp.dat", FileMode.Open))
                  {
  
                      file.Seek(0, SeekOrigin.Begin);
                      deserializedInstance =  MessagePackSerializer.Deserialize&lt;ExtendedItem&gt;(file);
  
                  }
  </code></pre>
  
  <p>looking at the deserializedInstance Childs elements they all are from Item Type. 
  Can you tell me what I'm doing wrong ? What is missing ?</p>
  
  <p>A small update regarding Item definition:</p>
  
  <pre><code> [DataContract]  
      [KnownType(typeof(IntermediateItem))]
      [KnownType(typeof(ExtendedItem))]
      public class Item
      {
          [DataMember]
          public int Id { get; set; }
  
          [DataMember]
          public string Name { get; set; }
  
          [DataMember]
          public bool Valid { get; set; }
      }
  </code></pre>
  
  <p>This also does not work. :(</p>