this is the code strip
Assembly m_oAssembly = Assembly.LoadFrom(assemblySource);
Type m_oTypeClass = m_oAssembly.GetType(classname,false);
MethodInfo m_oMethodInfoRequestInitialize =
m_oTypeClass.GetMethod("Initialize",System.Reflect ion.BindingFlags.Public
|System.Reflection.BindingFlags.Instance);
object m_oClassInstance = Activator.CreateInstance(m_oTypeClass);
m_oMethodInfoRequestInitialize.Invoke(m_oClassInst ance,m_oRequestArguments);
Thanks in advance
Raj
--
Try it for free:
http://www.sharpVoice.com
"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
CKR Rajesh <_r************@usa.net> wrote: I have 2 dlls on which i have the same class MyClass defined. Say A.dll
and B.dll
The classes have a function (but different functionality)
void f();
I use .Net late binding using Activator.CreateInstanceFrom method to
dynamically call the method f() in either dll.
But I see that once i successfully call the f() method of either of the
dll, I am not able to call the f() method in the other dll even if
I pass the other dll's name as the parameter to CreateInstanceFrom
method. Always f() from the dll which got executed first is always getting
executed...
Am i missing something?
Rather than passing the other DLL's name, try using Assembly.GetType on
the appropriate loaded assembly, and then creating an instance using
Activator.CreateInstance passing in the actual type.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too