动态加载某程序集中的某类型实例

Assembly ass = Assembly.LoadFrom("TestClassLibrary.dll");

Type t = ass.GetType("TestClassLibrary.TestUserControl");

UserControl uc = Activator.CreateInstance(t) as UserControl;



if (uc != null)

{

    splitContainer1.Panel2.Controls.Clear();

    uc.Dock = DockStyle.Fill;

    splitContainer1.Panel2.Controls.Add(uc);

}

你可能感兴趣的:(实例)