TomlDerivedTypeAttribute Class
Registers a derived type for polymorphic TOML serialization.
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
public sealed class TomlDerivedTypeAttribute : TomlAttribute- Inheritance
TomlAttributeTomlDerivedTypeAttribute
Constructors
| Name | Description |
|---|---|
| TomlDerivedTypeAttribute(Type) | Initializes a new instance of the TomlDerivedTypeAttribute class as the default derived type (no discriminator). When a type is registered without a discriminator, it becomes the default type used when the discriminator property is missing or does not match any registered type. |
| TomlDerivedTypeAttribute(Type, int) | Initializes a new instance of the TomlDerivedTypeAttribute class with an integer discriminator. |
| TomlDerivedTypeAttribute(Type, string) | Initializes a new instance of the TomlDerivedTypeAttribute class with a string discriminator. |
TomlDerivedTypeAttribute overloads
TomlDerivedTypeAttribute(Type)
TomlDerivedTypeAttribute.csInitializes a new instance of the TomlDerivedTypeAttribute class as the default derived type (no discriminator). When a type is registered without a discriminator, it becomes the default type used when the discriminator property is missing or does not match any registered type.
public TomlDerivedTypeAttribute(Type derivedType)Parameters
derivedTypeType- The derived CLR type.
TomlDerivedTypeAttribute(Type, int)
TomlDerivedTypeAttribute.csInitializes a new instance of the TomlDerivedTypeAttribute class with an integer discriminator.
TomlDerivedTypeAttribute(Type, string)
TomlDerivedTypeAttribute.csInitializes a new instance of the TomlDerivedTypeAttribute class with a string discriminator.
Properties
| Name | Description |
|---|---|
| DerivedType | Gets the derived CLR type. |
| Discriminator | Gets the discriminator value, or null if this is the default derived type. |