Find with Reflection the interfaces a class implements

  • Thread starter Thread starter Cezar
  • Start date Start date
C

Cezar

Hello,

Can anyone please help me with this matter.
I try to find the interfaces implemented by a class using
Reflection.

e.g:
public class A : InterfaceB, InterfaceC

how can I get (the info about) the "custom" interfaces InterfaceB
and InterfaceC ?

Thank you,
Cezar
 
Cezar said:
Can anyone please help me with this matter.
I try to find the interfaces implemented by a class using
Reflection.

e.g:
public class A : InterfaceB, InterfaceC

how can I get (the info about) the "custom" interfaces InterfaceB
and InterfaceC ?

Look at Type.GetInterfaces.
 
Look at Type.GetInterfaces.

Thanks again Jon for your reply.

I was using Type's IsInterface before... and I don't know yet why
it didn't return everything.

I have another question:

If my class implements another class, what should I use ? I didn't
see a GetBaseClass or something ...

public class MyClass : MyBaseClass

Cezar
 
Cezar said:
Thanks again Jon for your reply.

I was using Type's IsInterface before... and I don't know yet why
it didn't return everything.

I have another question:

If my class implements another class, what should I use ? I didn't
see a GetBaseClass or something ...

public class MyClass : MyBaseClass

The Type.BaseType property does what you want.
 
Back
Top