一次性设置设置所有属性值,当然要保证属性的类型相同

foreach (PropertyInfo propertyInfo in base.GetType().GetProperties())
             {
                 if (propertyInfo.CanWrite)
                 {
                     propertyInfo.SetValue(this, tag, null);
                 }
             }

猜你喜欢

转载自www.cnblogs.com/atuo/p/8963046.html