2015-12-29 工作笔记-2
2015-12-29 13:00
323 查看
1、通过属性字段获得属性的值
//根据属性字段获得属性值 public string GetObjectPropertyValue<T>(T t, string propertyname) { Type type = typeof(T); PropertyInfo property = type.GetProperty(propertyname); if (property == null) return string.Empty; object o = property.GetValue(t, null); if (o == null) return string.Empty; return o.ToString(); }
相关文章推荐
- Android退出应用最优雅的方式
- UVA 11361 - Investigating Div-Sum Property 数位DP
- Windows7添加SSD硬盘后重启卡住正在启动
- 例题5-8 UVA 400 Unix Is命令
- 杭电 最小生成树 2122 Ice_cream’s world III
- Android Notification.setLatestEventInfo()警告
- perl连接mysql
- Gabor滤波器:Gabor Filters
- loadrunner与ab对比
- 注册irc用户名以及申请irc频道 管理员退出后再登录如何获取管理员权限
- Linux C 数据结构——二叉树
- Get和Post区别,EncType提交数据的格式详解
- 算法导论22.4拓扑排序 练习总结
- (转)python requests的安装与简单运用
- [Phonegap+Sencha Touch] 移动开发72 List列表横向滑动操作(仿QQ列表滑动删除)
- VB SENDMESSAGE BM_CLICK
- 每天学习十分钟3之学习心得
- C++ 中获取 可变形參函数中的參数
- js与jQuery操作select大全
- Win10系统中误删的文件怎么恢复?