I'm trying to load a DLL runtime and invoke a method in one of the classes present in DLL.
Here is where I've loaded the DLL and invoking method,
Object[] mthdInps = new Object[2];
mthdInps[0] = mScope;
string paramSrvrName = srvrName;
mthdInps[1] = paramSrvrName;
Assembly runTimeDLL = Assembly.LoadFrom("ClassLibrary.dll");
Type runTimeDLLType = runTimeDLL.GetType("ClassLibrary.Class1");
Object compObject = Activator.CreateInstance(runTimeDLLType, mthdInps);
Type compClass = compObject.GetType();
MethodInfo mthdInfo = compClass.GetMethod("Method1");
string mthdResult = (string)mthdInfo.Invoke(compObject, null);
Here is the Class(present in DLL) and its method I'm trying to invoke,
namespace ClassLibrary
{
public class Class1
{
public Class1() {}
public String Method1(Object[] inpObjs)
{
}
}
}
The error I'm getting is this,
Constructor on type 'ClassLibrary.Class1' not found.
Please help.