Class DiscriminatorOptions
Extend this class to configure a type with a discriminator field.
Inheritance
System.Object
DiscriminatorOptions
Namespace: cqhttp.Cyan.Utils
Assembly: cqhttp.Cyan.dll
Syntax
public abstract class DiscriminatorOptions : object
Properties
| Improve this Doc View SourceActivator
Callback that creates an object which will then be populated by the serializer.
Declaration
public CustomObjectCreator Activator { get; protected set; }
Property Value
Type | Description |
---|---|
CustomObjectCreator |
BaseType
Gets the base type, which is typically (but not necessarily) abstract.
Declaration
public abstract Type BaseType { get; }
Property Value
Type | Description |
---|---|
Type |
DiscriminatorFieldName
Gets the name of the discriminator field.
Declaration
public abstract string DiscriminatorFieldName { get; }
Property Value
Type | Description |
---|---|
System.String |
FallbackType
Gets the fallback type, which is typically (but not necessarily) abstract.
Declaration
public abstract Type FallbackType { get; }
Property Value
Type | Description |
---|---|
Type |
Preprocessor
Callback that can optionally mutate the JObject before it is converted.
Declaration
public JsonPreprocessor Preprocessor { get; protected set; }
Property Value
Type | Description |
---|---|
JsonPreprocessor |
SerializeDiscriminator
Returns true if the discriminator should be serialized to the CLR type; otherwise false.
Declaration
public abstract bool SerializeDiscriminator { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Methods
| Improve this Doc View SourceGetDiscriminatedTypes()
Gets the mappings from discriminator values to CLR types.
Declaration
public abstract IEnumerable<(string TypeName, Type Type)> GetDiscriminatedTypes()
Returns
Type | Description |
---|---|
IEnumerable<System.ValueTuple<System.String, Type>> |