By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,773 Members | 1,778 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,773 IT Pros & Developers. It's quick & easy.

Get Implementation/Interface Declaration from Method using Reflection?

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Rob wrote:
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
Nov 20 '05 #2

P: n/a
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
Arne Janning <sp*****************@msn.com> wrote in message news:<et**************@tk2msftngp13.phx.gbl>...
Rob wrote:
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 reflection 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

Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.