Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Class

OfficeDerivedTypeAttribute

OfficeIMO

Namespace
OfficeIMO
Assembly
OfficeIMO.Core
Source revision
ac7e6e1bad8a with working tree changes
Base
Attribute
Modifiers
sealed
Attributes
AttributeUsage(1028, AllowMultiple = true, Inherited = false)

Registers a derived type of the annotated class or interface for polymorphic serialization. A value of the derived type is written with its discriminator, and reading creates the derived type only for that discriminator: the input never names a .NET type by itself.

Inheritance

  • Attribute
  • OfficeDerivedTypeAttribute

Remarks

YAML writes the discriminator as the local tag !discriminator by default. TOML has no tags, so it writes the discriminator as a key, $type by default. OfficePolymorphicAttribute.DiscriminatorPropertyName on the base type makes both formats use a key with that name.

Constructors

public OfficeDerivedTypeAttribute(Type derivedType, string discriminator) #

Creates the attribute.

Parameters

derivedType System.Type required
A concrete type that derives from or implements the annotated type.
discriminator string required
The text that identifies derivedType in the serialized form.

Properties

public Type DerivedType { get; } #

Gets the derived type.

public string Discriminator { get; } #

Gets the discriminator.