//Instantiate Derived Class
Type impType = Type.GetType("DerivedClass");
obj = impType.InvokeMember(null,
BindingFlags.DeclaredOnly |
BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.CreateInstance, null, null, args
);
//Call MethodA
res = (bool)impType.InvokeMember("MethodA",
BindingFlags.DeclaredOnly |
BindingFlags.Public | BindingFlags.NonPublic |
BindingFlags.Instance | BindingFlags.InvokeMethod
,null,obj,null);
This code does not work. I get a MissingMethod Exception when trying
to Invoke MethodA. Is it because MethodA is contained in the base
class and not in the instantiated class? Any help would be appreciated..