我做了一个用户控件,(一个textbox,一个button),在其中,我写了接口,我想别人继承我的用户接口的时候,button控件能动态的调用到他继承的接口
例子如下:private button_1 ()
{
   //在这里我想动态按钮事件用户继承的class Test
}
public interface ITest
{
}public class Test:ITest
{
   string back()
   {
    string s = "hao";
   }
}
谢谢各位大哥了,谢谢

解决方案 »

  1.   

    真的很难懂你的意思,网上的一例子,看看吧
    System.Reflection.Assembly a = System.Reflection.Assembly.LoadFrom(@"E:\ClassLibrary1.dll");
             MessageBox.Show(a.ToString());
    Type t = a.GetType("ClassLibrary1.Class1");
                               Type interfaceCon = t.GetInterface("yy");

    MessageBox.Show(interfaceCon.Assembly.ToString());

    if( t!=null )
    {
    ClassLibrary1.yy o =(ClassLibrary1.yy) Activator.CreateInstance(t);
    o.test();

    }namespace ClassLibrary1
    {
    public interface yy
    {
    void test();
             }
    public class Class1:yy
    {
             public void test()
    {
    System.Console.WriteLine("hello word");

    }

    }
    }