Get Implementation/Interface Declaration from Method using Reflection?

R

Rob

I'm using reflection to inspect a class and its methods. Is is
possible to determine if the class is a derived class or an interface
implementation? I'm using the MethodInfo object for relfection that I
use for acquiring the function names, scope, parameters, etc. Is
there an "InheritedClassType" or "InterfaceType" property that I can
query? I've tried using DeclaringType.BaseType, but that doesn't seem
to give me what I want.

Regards,
Rob
 
A

Arne Janning

Rob said:
I'm using reflection to inspect a class and its methods. Is is
possible to determine if the class is a derived class or an interface
implementation? I'm using the MethodInfo object for relfection that I
use for acquiring the function names, scope, parameters, etc. Is
there an "InheritedClassType" or "InterfaceType" property that I can
query?

I've tried using DeclaringType.BaseType
This is correct, why doesn't it work? What are you expecting? Code?

For Interfaces:
Type.GetInterfaces()

Cheers

Arne Janning
 
R

Rob

Arne -

Thanks for your reply.

Type.GetInterfaces() did the trick for inspecting the interfaces (I
was hoping it would be much more difficult than that), but that gets
me half-way there. For inspecting base class information,
Type.BaseType works (not Type.DeclaringType.BaseType, which is what I
had been trying).

- Rob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top