类定义:

    // 摘要: 
    //     指定另一特性类的用法。 此类不能被继承。
    [Serializable]
    [AttributeUsage(AttributeTargets.Class, Inherited = true)]
    [ComVisible(true)]
    public sealed class AttributeUsageAttribute : Attribute
    {
        // 摘要: 
        //     用指定的 System.AttributeTargets、System.AttributeUsageAttribute.AllowMultiple
        //     值和 System.AttributeUsageAttribute.Inherited 值列表初始化 System.AttributeUsageAttribute
        //     类的新实例。
        //
        // 参数: 
        //   validOn:
        //     使用按位"或"运算符组合的一组值,用于指示哪些程序元素是有效的。
        public AttributeUsageAttribute(AttributeTargets validOn);

        // 摘要: 
        //     获取或设置一个布尔值,该值指示能否为一个程序元素指定多个指示属性实例。
        //
        // 返回结果: 
        //     如果允许指定多个实例,则为 true;否则为 false。 默认值为 false。
        public bool AllowMultiple { get; set; }
        //
        // 摘要: 
        //     获取或设置一个布尔值,该值指示指示的属性能否由派生类和重写成员继承。
        //
        // 返回结果: 
        //     如果该属性可由派生类和重写成员继承,则为 true,否则为 false。 默认值为 true。
        public bool Inherited { get; set; }
        //
        // 摘要: 
        //     获取一组值,这组值标识指示的属性可应用到的程序元素。
        //
        // 返回结果: 
        //     一个或多个 System.AttributeTargets 值。 默认值为 All。
        public AttributeTargets ValidOn { get; }
    }
View Code

相关文章:

  • 2021-12-30
  • 2021-08-01
  • 2021-10-10
  • 2022-02-16
  • 2021-11-18
  • 2021-07-25
  • 2021-11-21
  • 2021-11-21
猜你喜欢
  • 2021-06-23
  • 2022-12-23
  • 2021-08-29
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案