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

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);
}
posted @ 2010-09-18 09:25  风中的云  阅读(158)  评论(0编辑  收藏  举报