修复一个clone时类型转换错误

This commit is contained in:
falcon 2022-04-15 14:37:06 +08:00
parent 760b5b9b43
commit 8916196cf2

View File

@ -22,7 +22,7 @@ namespace Falcon.SugarApi
join t in target.GetType().GetProperties() on s.Name equals t.Name join t in target.GetType().GetProperties() on s.Name equals t.Name
select new { s, t }; select new { s, t };
foreach (var item in all) { foreach (var item in all) {
item.t.SetValue(target, Convert.ChangeType(item.s.GetValue(source), item.s.PropertyType)); item.t.SetValue(target, Convert.ChangeType(item.s.GetValue(source), item.t.PropertyType));
} }
return source; return source;
} }