Get Implementation/Interface Declaration from Method using Reflection?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rob

    Get Implementation/Interface Declaration from Method using Reflection?

    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 "InheritedClass Type" or "InterfaceT ype" property that I can
    query? I've tried using DeclaringType.B aseType, but that doesn't seem
    to give me what I want.

    Regards,
    Rob
  • Arne Janning

    #2
    Re: Get Implementation/Interface Declaration from Method using Reflection?

    Rob wrote:
    [color=blue]
    > 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 "InheritedClass Type" or "InterfaceT ype" property that I can
    > query?[/color]

    [color=blue]
    > I've tried using DeclaringType.B aseType[/color]
    This is correct, why doesn't it work? What are you expecting? Code?

    For Interfaces:
    Type.GetInterfa ces()

    Cheers

    Arne Janning

    Comment

    • Rob

      #3
      Re: Get Implementation/Interface Declaration from Method using Reflection?

      Arne -

      Thanks for your reply.

      Type.GetInterfa ces() 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.DeclaringT ype.BaseType, which is what I
      had been trying).

      - Rob


      Arne Janning <spam.me-here.arnolo@msn .com> wrote in message news:<et7xPpmUE HA.1048@tk2msft ngp13.phx.gbl>. ..[color=blue]
      > Rob wrote:
      >[color=green]
      > > 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 "InheritedClass Type" or "InterfaceT ype" property that I can
      > > query?[/color]
      >
      >[color=green]
      > > I've tried using DeclaringType.B aseType[/color]
      > This is correct, why doesn't it work? What are you expecting? Code?
      >
      > For Interfaces:
      > Type.GetInterfa ces()
      >
      > Cheers
      >
      > Arne Janning[/color]

      Comment

      Working...