私は、AAAという名前のアプリケーションを持っていることを考えてみましょう。 今すぐIm BBBという名前のアセンブリをロードします.Aseembly BBBには、イベントとデリゲートの宣言があります。 BBBのイベントハンドラはAAAで利用可能です。 アセンブリBBBをロードしている間、私はイベントのハンドラをAAAに追加する必要があります。 イベントがBBBで発生するたびに、AAA shoudのハンドラメソッドが自動的に実行されます。 これを行う方法..........?using System.Reflection
私はAAA
Assembly tstComponent = Assembly.LoadFile(BBB);
Type Global = tstComponent.GetType(ClassInBBB, false, true);
if (Global != null)
{
EventInfo l_objevent = Global.GetEvent("OnGetdelInBBB");
Type l_objEveType = l_objevent.EventHandlerType;
Type Dis = Assembly.GetExecutingAssembly().GetType("AAA", false, true);
MethodInfo l_method = Dis.GetMethod("HandlerinAAA");
Delegate d = Delegate.CreateDelegate(l_objEveType, l_method);//Getting argument bind exception in this line
MethodInfo addHandler = l_objevent.GetAddMethod();
Object[] addHandlerArgs = { d };
addHandler.Invoke(Dis, addHandlerArgs);
}
でDISのようにコード化された私を助けてください。事前