123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- using System;
- using System.ComponentModel;
- using ProtoBuf.Meta;
- #if FEAT_IKVM
- using Type = IKVM.Reflection.Type;
- using IKVM.Reflection;
- #else
- using System.Reflection;
- #endif
- namespace ProtoBuf
- {
-
-
-
-
-
-
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
- public sealed class ProtoIncludeAttribute : Attribute
- {
-
-
-
-
-
- public ProtoIncludeAttribute(int tag, System.Type knownType)
- : this(tag, knownType == null ? "" : knownType.AssemblyQualifiedName) { }
-
-
-
-
-
- public ProtoIncludeAttribute(int tag, string knownTypeName)
- {
- if (tag <= 0) throw new ArgumentOutOfRangeException("tag", "Tags must be positive integers");
- if (Helpers.IsNullOrEmpty(knownTypeName)) throw new ArgumentNullException("knownTypeName", "Known type cannot be blank");
- this.tag = tag;
- this.knownTypeName = knownTypeName;
- }
-
-
-
- public int Tag { get { return tag; } }
- private readonly int tag;
-
-
-
- public string KnownTypeName { get { return knownTypeName; } }
- private readonly string knownTypeName;
-
-
-
- public Type KnownType
- {
- get
- {
- return TypeModel.ResolveKnownType(KnownTypeName, null, null);
- }
- }
-
-
-
-
- [DefaultValue(DataFormat.Default)]
- public DataFormat DataFormat
- {
- get { return dataFormat; }
- set { dataFormat = value; }
- }
- private DataFormat dataFormat = DataFormat.Default;
- }
- }
|