コード例 #1
0
        /// <summary>
        /// Marks a target with the Include attribute. 
        /// Attribute doesn't handle enforcing.
        /// </summary>
        /// <param name="includeIndex">A valid unique <see cref="GladNetIncludeIndex"/> for the target <see cref="Type"/>.</param>
        /// <param name="type">Type of the derived or base Type to associate with. (Unenforced to be a derived or subtype)</param>
        /// <exception cref="ArgumentOutOfRangeException">Throws if tagID is 0 or negative.</exception>
        public GladNetSerializationIncludeAttribute(GladNetIncludeIndex includeIndex, Type type, bool isForDerived = true)
            : base()
        {
            //uint is not CLS compliant. We have no reason to use uint in .Net
            Throw<ArgumentException>.If.IsTrue(!Enum.IsDefined(typeof(GladNetIncludeIndex), includeIndex))?.Now();
            Throw<ArgumentNullException>.If.IsNull(type)
                ?.Now(nameof(type), $"DerivedType cannot be null in {nameof(GladNetSerializationIncludeAttribute)}.ctor(...).");

            IncludeForDerived = isForDerived;
            TypeToWireTo = type;
            TagID = (int)includeIndex;
        }
コード例 #2
0
 public TestClindAttribute(GladNetIncludeIndex includeIndex, Type type, bool isForDerived = true)
     : base(includeIndex, type, isForDerived)
 {
 }