Click or drag to resize
MessagePackRuntimeTypeAttribute Class
Marks that the runtime type of this member should be encoded with type information for polymorphism.
Inheritance Hierarchy

Namespace: MsgPack.Serialization
Assembly: MsgPack (in MsgPack.dll) Version: 0.6.0
public sealed class MessagePackRuntimeTypeAttribute : Attribute

The MessagePackRuntimeTypeAttribute type exposes the following members.

Public methodMessagePackRuntimeTypeAttribute
Initializes a new instance of the MessagePackRuntimeTypeAttribute class.
When you apply this attribute to a member, the member will be serialized with .NET specific type information, so deserializer will be able to deserialize object which is actual type when serialized instead of interoperability. Because non-.NET enviroments (Java, Ruby, Go, etc.) cannot interpret .NET native type identifier, you should not use this attribute when the serialized stream will be possible to be used from non-.NET environment. The typed object will be encoded as 2 elements array as follows, so your deserializer can skip type information as needed: [ <type-info>, <actual-value (array or map)>] In this point, type-info will be encoded as compressed assembly qualified name as follows: [ <compressed type full name>, <assembly simple name>, <version binary>, <culture string>, <public key token binary>] If the type full name starts with its assembly simple name, then the prefix matched to assembly simple name will be omitted (as a result, compressed type name starts with dot).
Note Note
You should use this attribute CAREFULLY when you deserialize data from outside, because this feature can inject arbitary process in your code through constructor and some virtual methods if exist. It is highly recommended avoid using Object type as member's declaring type, you should specify your base class which and derived typed are fully controled under your organization instead. It mitigate chance of potential exploits.
See Also