T
TJO
I am trying to load an assembly, instantiate a class and invoke a
non-static void method using the following code:
I am getting the error "Non-static method requires a target" on the
InvokeMember method but don't see why. Can anyone shed light on this??
Assembly testAssembly =
Assembly.LoadFile(@"C:\STProjects\..\MyAssembly.dll");
Type testType =
testAssembly.GetType(this._cmbo_TestClasses.Text.Trim());
object[] args = new object[]{"myparam"};
SmartMI_TestClasses.HDDUtilization HDDtest =
(SmartMI_TestClasses.HDDUtilization)
testAssembly.CreateInstance(
testType.Name,
false, BindingFlags.Default, null,
args, null, null);
object o = testType.InvokeMember(
"_ExecuteTest",
BindingFlags.InvokeMethod,
null, HDDtest, null);
non-static void method using the following code:
I am getting the error "Non-static method requires a target" on the
InvokeMember method but don't see why. Can anyone shed light on this??
Assembly testAssembly =
Assembly.LoadFile(@"C:\STProjects\..\MyAssembly.dll");
Type testType =
testAssembly.GetType(this._cmbo_TestClasses.Text.Trim());
object[] args = new object[]{"myparam"};
SmartMI_TestClasses.HDDUtilization HDDtest =
(SmartMI_TestClasses.HDDUtilization)
testAssembly.CreateInstance(
testType.Name,
false, BindingFlags.Default, null,
args, null, null);
object o = testType.InvokeMember(
"_ExecuteTest",
BindingFlags.InvokeMethod,
null, HDDtest, null);