DiscriminatedTypeJsonConverter<TBase> Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Allows type hierarchies to be de/serialized by automatically applying, and then reading, an additional json property with a type discriminator value. In addition to the Newtonsoft.Json.JsonConverterAttribute, the base type should also be decorated with one or more TypeDiscriminatorAttribute.
generic <typename TBase>
where TBase : classpublic ref class DiscriminatedTypeJsonConverter : Newtonsoft::Json::JsonConverter<TBase>
public class DiscriminatedTypeJsonConverter<TBase> : Newtonsoft.Json.JsonConverter<TBase> where TBase : class
type DiscriminatedTypeJsonConverter<'Base (requires 'Base : null)> = class
inherit JsonConverter<'Base (requires 'Base : null)>
Public Class DiscriminatedTypeJsonConverter(Of TBase)
Inherits JsonConverter(Of TBase)
Type Parameters
- TBase
The base type of the hierarchy.
- Inheritance
-
Newtonsoft.Json.JsonConverter<TBase>DiscriminatedTypeJsonConverter<TBase>
Remarks
All subtypes in the type hierarchy must support initialization via a constructor. This converter will not work with subtypes that only have default constructors and writable properties.
Constructors
DiscriminatedTypeJsonConverter<TBase>() |
Initializes a new instance of the DiscriminatedTypeJsonConverter<TBase> class, using '$rpctype' for the name of the property that stores the type discriminator value. Failures in type discrimation will throw.
|
DiscriminatedTypeJsonConverter<TBase>(Boolean, String) |
Initializes a new instance of the DiscriminatedTypeJsonConverter<TBase> class, using '$rpctype' for the name of the property that stores the type discriminator value. |
DiscriminatedTypeJsonConverter<TBase>(Boolean) |
Initializes a new instance of the DiscriminatedTypeJsonConverter<TBase> class, using '$rpctype' for the name of the property that stores the type discriminator value. |
DiscriminatedTypeJsonConverter<TBase>(String) |
Initializes a new instance of the DiscriminatedTypeJsonConverter<TBase> class,
using |
DiscriminatedTypeJsonConverter<TBase>(Type, String) |
Initializes a new instance of the DiscriminatedTypeJsonConverter<TBase> class. |
DiscriminatedTypeJsonConverter<TBase>(Type) |
Initializes a new instance of the DiscriminatedTypeJsonConverter<TBase> class, using '$rpctype' for the name of the property that stores the type discriminator value. |
Methods
ReadJson(JsonReader, Type, TBase, Boolean, JsonSerializer) | Newtonsoft.Json.JsonConverter`1.ReadJson(Newtonsoft.Json.JsonReader,System.Type,`0,System.Boolean,Newtonsoft.Json.JsonSerializer) |
WriteJson(JsonWriter, TBase, JsonSerializer) | Newtonsoft.Json.JsonConverter`1.WriteJson(Newtonsoft.Json.JsonWriter,`0,Newtonsoft.Json.JsonSerializer) |