private object GetValueByProperty(string key, string value, ref Type typeValue)
{
Type t = typeof(T);
var property = t.GetProperty(key);
if (property == null)
{
return value;
} Type pt = property.PropertyType.IsGenericType && !property.PropertyType.IsGenericTypeDefinition
? property.PropertyType.GetGenericArguments()[] : property.PropertyType;
object obj = Convert.ChangeType(value, pt);
if (property.PropertyType.IsGenericType && !property.PropertyType.IsGenericTypeDefinition)
{
typeValue = property.PropertyType;
}
else
{
typeValue = pt;
}
return obj;
}

key:属性名称

value:字符串类型的值

typevalue:属性类型

返回:转换后的值

最新文章

  1. python基础_制作多级菜单_(运用:字典_列表_元组等知识)
  2. java读取邮件
  3. web前端开发工程师,你了解吗?
  4. 爬虫技术 -- 进阶学习(八)模拟简单浏览器(附c#代码)
  5. JS判断对象类型
  6. 经常遇到Please ensure that adb is correctly located at 'D:\java\sdk\platform-tools\adb.exe' and can be e
  7. HttpClient使用详解(转)
  8. ansible中文手册-基础模块使用
  9. mysql 主从同步 Last_SQL_Error
  10. jquery 动态添加下拉框 需要增加 煊染 selectmenu("refresh");
  11. html 5的localstorag
  12. Vim C/C++的一键编译
  13. [转]使用wireshark分析TCP/IP协议中TCP包头的格式
  14. MYSQL insert
  15. Python 基于TK 文本编辑器
  16. 理解容器之间的连通性 - 每天5分钟玩转 Docker 容器技术(34)
  17. SUSE12SP3-Mycat(2)Schema.xml配置详解
  18. 跨域两种解决方案CORS以及JSONP
  19. ERRORS !MySQL 和 Javaweb 的报错合集
  20. Pycharm Debug调试心得

热门文章

  1. HDU 1789 Doing Homework again(馋)
  2. 使用nodejs 来压缩整个目录
  3. JVM参数调优:Eclipse启动实践
  4. Java获取URL对应的资源
  5. C# 实现生成带二维码的专属微信公众号推广海报
  6. .NET开发人员的瓶颈和职业发展
  7. JDK源代码学习系列03----StringBuffer+StringBuilder
  8. 在.net core 的webapi项目中将对象序列化成json
  9. 第一泰泽(Tizen)智能手机发布在俄罗斯
  10. 嵌入式开发(*(volatile unsigned long *)) 认识