How to create duplicate allowed attributes

前端 未结 6 1788
旧巷少年郎
旧巷少年郎 2021-02-02 04:58

I\'m using a custom attribute inherited from an attribute class. I\'m using it like this:

[MyCustomAttribute(\"CONTROL\")]
[MyCustomAttribute(\"ALT\")]
[MyCustom         


        
6条回答
  •  伪装坚强ぢ
    2021-02-02 05:31

    After you add the AttributeUsage, make sure you add this property to your Attribute class

    public override object TypeId
    {
      get
      {
        return this;
      }
    }
    

提交回复
热议问题