0

I have a series of classes MyConcreteClass : MyBaseClass and a series of collection classes MyConcreteCollection : MyBaseCollection.

Where the fun part is that

public abstract class MyBaseCollection
{
    public List<MyBaseClass> MyItems :get; set;}
}

It serializes fine, and the objects inside MyItems do show up as the right items (lookin in the JSON with { TypeNameHandling = TypeNameHandling.All }; set

My problem is when I go to deserialize - obviously we can't create an object of List<MyBaseClass> (It is abstract) - I need to deserialize to List<MyConcreteClass> The good news? The List<MyConcreteClass> is ALWAYS the same for each type of MyConcreteCollection, aka

MyFirstCollectionType: MyBaseCollection the MyItems will always be of type FistConcreteType : MyBaseClass and MySecondCollectionType: MyBaseCollection will always be of type SecondConcreteType : MyBaseClass

I THINK it might be just a custom Converter, but I just don't get it.

dbc
  • 104,963
  • 20
  • 228
  • 340
Charles Gallo
  • 115
  • 1
  • 2
  • 8

0 Answers0