namespace PolymorphicDeSerialization.Models { public class HI1Object { public string ObjectIdentifier { get; set; } public int Generation { get; set; } // This serves the same purpose as the "typeDiscriminator" field. // I've called it xsiType because in OAS3 we can map the XSD xsiType // field (which is essentially XML's type discriminator) directly to JSON. // This just uses the .NET type name because it's just a demo and // I'm too lazy to actually map to the correct Qnames here. public string xsiType { get => this.GetType().ToString(); } public void ToString() { Console.WriteLine(this.GetType().Name); } } }