首页  编辑  

根据类型创建实例

Tags: /C#/RTTI/   Date Created:

Type vType = typeof ( Button );

object vObject = Activator . CreateInstance(vType);

vType . GetProperty( "Parent" ) . SetValue(vObject, this , null );

vType . GetProperty( "Text" ) . SetValue(vObject, "Zswang , null );