/// <summary>
/// 给对象赋值的方法(不赋地址)(同一个类型),含过滤
/// </summary>
/// <typeparam name="T"><peparam>
/// <param name="left">=号左边</param>
/// <param name="right">=号右边</param>
/// <param name="id">过滤条件</param>
public static void Assignment<T>(T left, T right, string id=null)
{
Type type = left.GetType();
List<PropertyInfo> pList = type.GetProperties().ToList();
for (int i = ; i < pList.Count; i++)
{
//根据属性名获得指定的属性对象
PropertyInfo gc = type.GetProperty(pList[i].Name);
//设置属性的值
if (id != null)
{
if (pList[i].Name != id)
{
gc.SetValue(left, pList[i].GetValue(right, null), null);
}
}
else
{
gc.SetValue(left, pList[i].GetValue(right, null), null);
} }
}

最新文章

  1. LoadRunner函数百科叒叒叒更新了!
  2. C 语言中 setjmp 和 longjmp
  3. windows系统和ubuntu虚拟机之间文件共享——samba
  4. MVC文章汇总
  5. spring web mvc中遇到的错误以及学习小记(持续记录)
  6. php 读取文件的几种方法
  7. ActiveMQ简介与安装
  8. tahoma字体对中文字的影响
  9. 如何不保存Word即可用Word打开想显示的内容!
  10. [置顶] 学习VB.NET编程最基本的三个问题
  11. Asp.Net Core WebApi学习笔记(四)-- Middleware
  12. Flex TextInput 动态推断输入内容
  13. 规划(纪念我在ACM道路上的一年)
  14. (转)递归算法的时间复杂度终结篇与Master method
  15. Hello_World
  16. 最长公共前缀(python) leetcode答案
  17. git如何创建 .gitignore文件
  18. 从零搭建 ES 搜索服务(六)相关性排序优化
  19. python &amp; MySQLdb(one)
  20. 树莓派.Qt.Creator安装方法

热门文章

  1. BZOJ 1029 JSOI2007 建筑抢修 贪心+堆
  2. 本地CS的导出xls代码段
  3. SQL Developer 警告--无法安装某些模块
  4. C++11 容器Array
  5. Freemarker-2.3.22 Demo - No04_条件判断
  6. Eclipse无法启动小结
  7. Python 进行 SSH 操作,实现本地与服务器的链接,进行文件的上传和下载
  8. DataTable 字段值为空的时候报错的解决
  9. 编程精粹--编写高质量C语言代码(1):假想编译程序
  10. 【WPF】Button按钮添加背景图片