using System; namespace MessagePack { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = true)] public class MessagePackObjectAttribute : Attribute { public bool KeyAsPropertyName { get; private set; } public MessagePackObjectAttribute(bool keyAsPropertyName = false) { this.KeyAsPropertyName = keyAsPropertyName; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)] public class KeyAttribute : Attribute { public int? IntKey { get; private set; } public string StringKey { get; private set; } public KeyAttribute(int x) { this.IntKey = x; } public KeyAttribute(string x) { this.StringKey = x; } } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)] public class IgnoreMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class, AllowMultiple = true, Inherited = false)] public class UnionAttribute : Attribute { public int Key { get; private set; } public Type SubType { get; private set; } public UnionAttribute(int key, Type subType) { this.Key = key; this.SubType = subType; } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = true)] public class SerializationConstructorAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Enum, AllowMultiple = false, Inherited = true)] public class MessagePackFormatterAttribute : Attribute { public Type FormatterType { get; private set; } public object[] Arguments { get; private set; } public MessagePackFormatterAttribute(Type formatterType) { this.FormatterType = formatterType; } public MessagePackFormatterAttribute(Type formatterType, params object[] arguments) { this.FormatterType = formatterType; this.Arguments = arguments; } } }