Table of Contents

Class DerivedTypeMapping<TBase>

Namespace
Nerdbank.MessagePack
Assembly
Nerdbank.MessagePack.dll

Describes a mapping between a base type and its known sub-types, along with the aliases that identify them.

public class DerivedTypeMapping<TBase> : DerivedShapeMapping<TBase>, IEnumerable<KeyValuePair<DerivedTypeIdentifier, ITypeShape>>, IEnumerable

Type Parameters

TBase

The base type or interface that all sub-types derive from or implement.

Inheritance
DerivedTypeMapping<TBase>
Implements
Inherited Members

Constructors

DerivedTypeMapping(ITypeShapeProvider)

Describes a mapping between a base type and its known sub-types, along with the aliases that identify them.

public DerivedTypeMapping(ITypeShapeProvider provider)

Parameters

provider ITypeShapeProvider

The type shape provider to use for a type when added without an express shape or provider.

Properties

BaseType

Gets the base union type.

public override Type BaseType { get; }

Property Value

Type

this[DerivedTypeIdentifier]

Gets or sets a sub-type's Type by its alias.

public Type this[DerivedTypeIdentifier alias] { get; set; }

Parameters

alias DerivedTypeIdentifier

The alias of the sub-type.

Property Value

Type

The Type associated with the specified alias.

Remarks

When adding a subtype via this indexer, the ITypeShape<T> for the value will be obtained from the ITypeShapeProvider provided to the constructor.

Methods

Add(DerivedTypeIdentifier, Type)

Adds a known sub-type to the mapping.

public void Add(DerivedTypeIdentifier alias, Type type)

Parameters

alias DerivedTypeIdentifier

The alias for the sub-type.

type Type

The Type of the sub-type.

Remarks

The ITypeShape<T> for the type will be obtained from the ITypeShapeProvider provided to the constructor.