Hi,
// create an instance on which the method will be invoked
DerivedClass obj = new DerivedClass();
// get the Type that defines the method (AbstractClass)
Type type = typeof(AbstractClass);
// get the method
MethodInfo m = type.GetMethod("AMethod",
BindingFlags.NonPublic | BindingFlags.Instance);
// invoke the method on the instance of DerivedClass
m.Invoke(obj, null);
--
Dave Sexton
"shiry" <sh****@gmail.comwrote in message
news:11**********************@j44g2000cwa.googlegr oups.com...
Hi,
Can anyone tell me how can I get a protected method of an abstract
class using reflection?
I need to invoke a method like this and I was trying invokeMember on
the type of the derived class with an object of the derived class. This
doesn't work.
I cannot perform this on the abstract class since I cannot instantiate
it.
What am I doing wrong?
Thanks.