MsgPack.Serialization.CollectionSerializers.NonGenericDictionaryMessagePackSerializer< TDictionary > Class Template Referenceabstract

Provides basic features for non-generic dictionary serializers. More...

Inherits MsgPack.Serialization.MessagePackSerializer< TDictionary >, and MsgPack.Serialization.CollectionSerializers.ICollectionInstanceFactory.

Inherited by MsgPack.Serialization.DefaultSerializers.AbstractNonGenericDictionaryMessagePackSerializer< TDictionary >, and MsgPack.Serialization.ReflectionSerializers.ReflectionNonGenericDictionaryMessagePackSerializer< TDictionary >.

Protected Member Functions

 NonGenericDictionaryMessagePackSerializer (SerializationContext ownerContext, PolymorphismSchema schema)
 Initializes a new instance of the NonGenericDictionaryMessagePackSerializer<TDictionary> class. More...
 
 NonGenericDictionaryMessagePackSerializer (SerializationContext ownerContext, PolymorphismSchema schema, SerializerCapabilities capabilities)
 Initializes a new instance of the NonGenericDictionaryMessagePackSerializer<TDictionary> class. More...
 
abstract TDictionary CreateInstance (int initialCapacity)
 Creates a new collection instance with specified initial capacity. More...
 

Additional Inherited Members

Detailed Description

Provides basic features for non-generic dictionary serializers.

Template Parameters
TDictionaryThe type of the dictionary.

This class provides framework to implement variable collection serializer, and this type seals some virtual members to maximize future backward compatibility. If you cannot use this class, you can implement your own serializer which inherits MessagePackSerializer<T> and implements ICollectionInstanceFactory.

Type Constraints
TDictionary :IDictionary 

Constructor & Destructor Documentation

◆ NonGenericDictionaryMessagePackSerializer() [1/2]

Initializes a new instance of the NonGenericDictionaryMessagePackSerializer<TDictionary> class.

Parameters
ownerContextA SerializationContext which owns this serializer.
schemaThe schema for collection itself or its items for the member this instance will be used to. null will be considered as PolymorphismSchema.Default.
Exceptions
ArgumentNullExceptionownerContext is null.

◆ NonGenericDictionaryMessagePackSerializer() [2/2]

Initializes a new instance of the NonGenericDictionaryMessagePackSerializer<TDictionary> class.

Parameters
ownerContextA SerializationContext which owns this serializer.
schemaThe schema for collection itself or its items for the member this instance will be used to. null will be considered as PolymorphismSchema.Default.
capabilitiesA serializer calability flags represents capabilities of this instance.
Exceptions
ArgumentNullExceptionownerContext is null.

Member Function Documentation

◆ CreateInstance()

abstract TDictionary MsgPack.Serialization.CollectionSerializers.NonGenericDictionaryMessagePackSerializer< TDictionary >.CreateInstance ( int  initialCapacity)
protectedpure virtual

Creates a new collection instance with specified initial capacity.

Parameters
initialCapacityThe initial capacy of creating collection. Note that this parameter may 0 for non-empty collection.
Returns
New collection instance. This value will not be null.

An author of Unpacker could implement unpacker for non-MessagePack format, so implementer of this interface should not rely on that initialCapacity reflects actual items count. For example, JSON unpacker cannot supply collection items count efficiently.

See also
ICollectionInstanceFactory.CreateInstance

Implements MsgPack.Serialization.CollectionSerializers.ICollectionInstanceFactory.


The documentation for this class was generated from the following file:
  • MsgPackSources/Serialization/CollectionSerializers/NonGenericDictionaryMessagePackSerializer`1.cs