/// <summary>
/// 将一个实体的值赋值到另外一个实体
/// </summary>
/// <param name="objectsrc">源实体</param>
/// <param name="objectdest">目标实体</param>
public void EntityToEntity(object objectsrc, object objectdest)
{
var sourceType = objectsrc.GetType();
var destType = objectdest.GetType();
foreach (var source in sourceType.GetProperties())
{
foreach (var dest in destType.GetProperties())
{
if (dest.Name == source.Name)
{
dest.SetValue(objectdest, source.GetValue(objectsrc));
}
}
}
}
将一个实体的值赋值到另外一个实体
最新推荐文章于 2024-03-13 11:43:58 发布