Table of Contents

Class DerivedTypeMappingCollection

Namespace
Nerdbank.MessagePack
Assembly
Nerdbank.MessagePack.dll

An immutable collection of DerivedShapeMapping<TBase> objects.

public class DerivedTypeMappingCollection : IReadOnlyCollection<DerivedTypeMapping>, IEnumerable<DerivedTypeMapping>, IEnumerable
Inheritance
DerivedTypeMappingCollection
Implements
Inherited Members

Remarks

Since the DerivedTypeMapping object is mutable and this collection must be immutable, we freeze the result of each mapping as it is added, and that is what is used during serialization. If the original DerivedTypeMapping object mutates later, serialization will be unaffected.

Properties

Count

Gets the number of elements in the collection.

public int Count { get; }

Property Value

int

The number of elements in the collection.

Methods

Create(ReadOnlySpan<DerivedTypeMapping>)

Constructs a new DerivedTypeMappingCollection from a collection of DerivedShapeMapping<TBase> objects.

public static DerivedTypeMappingCollection Create(ReadOnlySpan<DerivedTypeMapping> derivedTypeMappings)

Parameters

derivedTypeMappings ReadOnlySpan<DerivedTypeMapping>

The mappings to fill the collection with.

Returns

DerivedTypeMappingCollection

A new instance of DerivedTypeMappingCollection.

GetEnumerator()

Returns an enumerator that iterates through the collection.

public ImmutableArray<DerivedTypeMapping>.Enumerator GetEnumerator()

Returns

ImmutableArray<DerivedTypeMapping>.Enumerator

An enumerator that can be used to iterate through the collection.