public static void Fanshe(Module v)
{
PropertyInfo[] properties = v.GetType().GetProperties();
foreach (PropertyInfo property in properties)
{
if (property.GetValue(v) is not null)
{
var value = property.GetValue(v);
var moduleProperty = v.GetType().GetProperty(property.Name);
if (moduleProperty != null)
{
moduleProperty.SetValue(v, value);
}
}
}
}
.net core 利用反射为实体赋值
最新推荐文章于 2023-12-19 22:15:58 发布