阅读背景:

使用反射获取枚举的自定义属性Attribute及其他使用方式

来源:互联网 

自定义Attribue:ImgAttribute

[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)]
  sealed class ImgAttribute : Attribute
  {
      readonly string imgUrl;
  
      public  ImgAttribute(string imgUrl)
      {
          this.imgUrl = imgUrl;
      }
     /// <summary>
     /// 图片地址
     /// </summary>
     public string ImgUrl
     {
         get { return imgUrl; }
     }
 }
[AttributeUsage(



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: