1建立类Order
public class Order
{
public Order()
{
}
public void Show()
{
MessageBox.Show("显示 Invoke ");
}
}
2.使用ConstroInfo 的Invoke方法
Type myType=typeof(Order);
ConstructorInfo cInfo=myType.GetConstructor(new Type[]{});
if(cInfo==null)
{
MessageBox.Show("ConstructorInfo Is null");
}
else
{
object order=cInfo.Invoke(null);
((Order)order).Show();
}
本文介绍了一个C#编程示例,展示了如何创建一个名为Order的类,并通过ConstructorInfo的Invoke方法实例化该类的对象。此外,还演示了如何调用类中的Show方法。
3185

被折叠的 条评论
为什么被折叠?



