摘要:new一個由Type型態的欄位指定類別的方法
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Type type = typeof(myClass);
myClass obj = Activator.CreateInstance(type) as myClass;
obj.PropretyA = 0;
}
public class myClass
{
public int PropretyA { set; get; }
public string PropretyB { set; get; }
}
}
}