Table of Contents

Class MsgPackKeyAttribute

Namespace
ShapeShift.MsgPack
Assembly
ShapeShift.MsgPack.dll

Assigns the stable position a member occupies in a type that declares MsgPackArrayContractAttribute.

[AttributeUsage(AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
public sealed class MsgPackKeyAttribute : Attribute
Inheritance
MsgPackKeyAttribute
Inherited Members

Remarks

The attribute may be applied to a property or field, or to a constructor parameter (which is the natural place for it on a positional record). When both a parameter and its matching property carry one, they must agree.

This attribute has no effect on a type that does not declare MsgPackArrayContractAttribute, and no effect on any format other than MessagePack.

Constructors

MsgPackKeyAttribute(int)

Assigns the stable position a member occupies in a type that declares MsgPackArrayContractAttribute.

public MsgPackKeyAttribute(int index)

Parameters

index int

The 0-based position of this member within the MessagePack array. It must be unique within the declaring type and no greater than MaxIndex.

Remarks

The attribute may be applied to a property or field, or to a constructor parameter (which is the natural place for it on a positional record). When both a parameter and its matching property carry one, they must agree.

This attribute has no effect on a type that does not declare MsgPackArrayContractAttribute, and no effect on any format other than MessagePack.

Fields

MaxIndex

The largest position a positional contract may assign.

public const int MaxIndex = 1023

Field Value

int

Remarks

Positions are array indexes, and every position below the highest one in use costs at least one byte on the wire even when nothing occupies it. This bound keeps a typo from turning a small object into an enormous array.

Properties

Index

Gets the 0-based position of this member within the MessagePack array.

public int Index { get; }

Property Value

int