Click or drag to resize
MessagePackDeserializationConstructorAttribute Class
Marks this constructor used as deserialization constructor.
Inheritance Hierarchy
SystemObject
  SystemAttribute
    MsgPack.SerializationMessagePackDeserializationConstructorAttribute

Namespace: MsgPack.Serialization
Assembly: MsgPack (in MsgPack.dll) Version: 0.6.0
Syntax
[AttributeUsageAttribute(AttributeTargets.Constructor)]
public sealed class MessagePackDeserializationConstructorAttribute : Attribute

The MessagePackDeserializationConstructorAttribute type exposes the following members.

Constructors
  NameDescription
Public methodMessagePackDeserializationConstructorAttribute
Initializes a new instance of the MessagePackDeserializationConstructorAttribute class.
Top
Remarks

This attribute only used once per type. If there are multiple constructors marked with this attribute in the type, SerializationException will be onccured in serializer generation.

Marking with this attribute is not required to generate serializer which uses constructor in deserialization, but this attribute is available in following purposes:

  • Indicating force constructor deserialization instead of member deserialization. The serializer generation prefer member (that is using property setters and fields) deserialization as possible. You can indicate to forcibly use constructor even when there are any setters/writable fields.

    If you do not specify this attribute in this case, member deserialization strategy will be used.

  • Clarify the constructor which wil be used in deserialization when there are multiple constructors declared in the type. Although the serializer generator avoids default constructor and non-public constructors, it cannot resolve target constructor when there are multiple candidates (that is, public, parameterized constructors).

    If you do not specify this attribute in this case, serializer generator throws SerializationException.

See Also