MessagePackRuntimeTupleItemTypeAttribute Class |
Marks that the runtime type of specified item of the tuple should be encoded with type information for polymorphism.
Inheritance Hierarchy
Namespace: MsgPack.SerializationAssembly: MsgPack (in MsgPack.dll) Version: 0.6.0
Syntax [AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = true)]
public sealed class MessagePackRuntimeTupleItemTypeAttribute : Attribute
<AttributeUsageAttribute(AttributeTargets.Property Or AttributeTargets.Field, AllowMultiple := true)>
Public NotInheritable Class MessagePackRuntimeTupleItemTypeAttribute
Inherits Attribute
[AttributeUsageAttribute(AttributeTargets::Property|AttributeTargets::Field, AllowMultiple = true)]
public ref class MessagePackRuntimeTupleItemTypeAttribute sealed : public Attribute
[<SealedAttribute>]
[<AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field, AllowMultiple = true)>]
type MessagePackRuntimeTupleItemTypeAttribute =
class
inherit Attribute
end
The MessagePackRuntimeTupleItemTypeAttribute type exposes the following members.
Constructors Properties
| Name | Description |
---|
| ItemNumber |
Gets the target tuple item's number.
|
TopRemarks
When you apply this attribute to a member, the item of tuple 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 |
---|
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