MsgPack.Serialization.CollectionSerializers.ICollectionInstanceFactory Interface Reference

Defines common interface for serializers which can genereate new empty instance. More...

Inherited by MsgPack.Serialization.CollectionSerializers.DictionaryMessagePackSerializerBase< TDictionary, TKey, TValue >, MsgPack.Serialization.CollectionSerializers.EnumerableMessagePackSerializerBase< TCollection, TItem >, MsgPack.Serialization.CollectionSerializers.NonGenericDictionaryMessagePackSerializer< TDictionary >, MsgPack.Serialization.CollectionSerializers.NonGenericEnumerableMessagePackSerializerBase< TCollection >, MsgPack.Serialization.DefaultSerializers.MsgPack_MessagePackObjectDictionaryMessagePackSerializer, MsgPack.Serialization.DefaultSerializers.System_Collections_Generic_Dictionary_2MessagePackSerializer< TKey, TValue >, MsgPack.Serialization.DefaultSerializers.System_Collections_Generic_List_1MessagePackSerializer< T >, MsgPack.Serialization.DefaultSerializers.System_Collections_Generic_ListOfMessagePackObjectMessagePackSerializer, MsgPack.Serialization.DefaultSerializers.System_Collections_QueueMessagePackSerializer, MsgPack.Serialization.DefaultSerializers.System_Collections_StackMessagePackSerializer, and MsgPack.Serialization.TypedMessagePackSerializerWrapper< T >.

Public Member Functions

object CreateInstance (int initialCapacity)
 Creates a new collection instance with specified initial capacity. More...
 

Detailed Description

Defines common interface for serializers which can genereate new empty instance.

All custom manually implemented or automatically generated serializers which treat collection (that is, they return objects implementing System.Collections.IEnumerable except few exceptions like string).

Member Function Documentation

◆ CreateInstance()

object MsgPack.Serialization.CollectionSerializers.ICollectionInstanceFactory.CreateInstance ( int  initialCapacity)

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.

Implemented in MsgPack.Serialization.CollectionSerializers.DictionaryMessagePackSerializerBase< TDictionary, TKey, TValue >, MsgPack.Serialization.CollectionSerializers.NonGenericDictionaryMessagePackSerializer< TDictionary >, MsgPack.Serialization.CollectionSerializers.EnumerableMessagePackSerializerBase< TCollection, TItem >, and MsgPack.Serialization.CollectionSerializers.NonGenericEnumerableMessagePackSerializerBase< TCollection >.


The documentation for this interface was generated from the following file:
  • MsgPackSources/Serialization/CollectionSerializers/ICollectionInstanceFactory.cs