mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-04-14 05:06:36 +08:00
系统优化
This commit is contained in:
@@ -90,15 +90,18 @@ namespace AIStudio.Wpf.DiagramDesigner
|
||||
D d = Activator.CreateInstance<D>(); //构造新实例
|
||||
try
|
||||
{
|
||||
var Types = s.GetType();//获得类型
|
||||
var Typed = typeof(D);
|
||||
foreach (PropertyInfo sp in Types.GetProperties().Where(p => p.CanRead))//获得类型的属性字段
|
||||
if (s != null)
|
||||
{
|
||||
foreach (PropertyInfo dp in Typed.GetProperties().Where(p => p.CanWrite))
|
||||
var Types = s.GetType();//获得类型
|
||||
var Typed = typeof(D);
|
||||
foreach (PropertyInfo sp in Types.GetProperties().Where(p => p.CanRead))//获得类型的属性字段
|
||||
{
|
||||
if (dp.Name == sp.Name && dp.PropertyType == sp.PropertyType)//判断属性名是否相同
|
||||
foreach (PropertyInfo dp in Typed.GetProperties().Where(p => p.CanWrite))
|
||||
{
|
||||
dp.SetValue(d, sp.GetValue(s, null), null);//获得s对象属性的值复制给d对象的属性
|
||||
if (dp.Name == sp.Name && dp.PropertyType == sp.PropertyType)//判断属性名是否相同
|
||||
{
|
||||
dp.SetValue(d, sp.GetValue(s, null), null);//获得s对象属性的值复制给d对象的属性
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user