c#通过反射获取自定义属性
2016-07-08 15:26
501 查看
PropertyInfo[] properties = typeof(BPM_ContractApproval_Purchase).GetProperties(); foreach (var property in properties) { string text = Convert.ToString(property.GetValue(entity)); var dingtalkAttribute = property.GetCustomAttribute(typeof(DingTalkFormInfoAttribute)) as DingTalkFormInfoAttribute; if (dingtalkAttribute != null) { var attribute = property.GetCustomAttribute(typeof(DisplayAttribute)) as DisplayAttribute; customeAttribute.Add(new BPM_Attribute_Dto() { Label = attribute != null ? attribute.Name : "", Text = text, OrderIndex = dingtalkAttribute.Index }); } }
相关文章推荐
- 使用UAParser在C#MVC项目中如何判断用户是在用什么设备进行访问(手机,平板还是普通的电脑)
- C# 中的委托和事件
- C++ 通过DLL调用C#代码
- c#, 输出二进制
- c#语言编写读取日志便于调试
- C#新手入门代码 console.writeline输出变量
- C#新手入门代码 exe程序闪退的解决方法
- C# 判断txt文件编码格式
- c# UDP
- C#以中心点经纬度和范围半径为基准计算矩形四个顶点的经纬度
- C# Winform 实现屏蔽键盘的win和alt+F4的实现代码
- C#获取本机IP搜集整理7种方法
- c#上传图片的代码
- C#学习篇(五)克隆
- C#中的@符号用法
- C# 实现是否设置指定程序为开机启动程序
- C#工具类(包含获取枚举描述方法)
- C#之类型转换
- 弹出MessageBox并延迟一段时间后自动关闭的一种方法
- C#基础