public D Mapper<D, S>(S s)
{
D d = Activator.CreateInstance<D>();
try
{
var sType = s.GetType();
var dType = typeof(D);
foreach (PropertyInfo sP in sType.GetProperties())
{
foreach (PropertyInfo dP in dType.GetProperties())
{
if (dP.Name == sP.Name)
{
dP.SetValue(d, sP.GetValue(s)); break;
}
}
}
}
catch (Exception ex)
{

}
return d;
}

posted on 2023-06-14 11:01  骑牛射雕  阅读(24)  评论(0编辑  收藏  举报