代码改变世界

随笔档案-2012年02月

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

2012-02-07 13:02 by ※森林小居※, 2347 阅读, 收藏, 编辑
摘要: 自定义Attribue:ImgAttribute[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = true)] sealed class ImgAttribute : Attribute { readonly string imgUrl; public ImgAttribute(string imgUrl) { this.imgUrl = imgUrl; } /// <summary> /// 图片地址 //... 阅读全文
点击右上角即可分享
微信分享提示