question on inheritance of interfaces..

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

    question on inheritance of interfaces..


    I have interface IAbc,IDef

    and interface IXyz inherits/implements(what is the right word) IAbc
    and IDef


    if i reflect the type IXyz it only shows me the members of IXyz and
    not IAbc and IDef.

    Why?

    TIA
  • chrisrock2@gmail.com

    #2
    Re: question on inheritance of interfaces..

    On Mar 5, 5:52 pm, parez <psaw...@gmail. comwrote:
      I have interface IAbc,IDef
    >
    and  interface  IXyz inherits/implements(what is the right word) IAbc
    and IDef
    >
     if  i  reflect the type IXyz it only shows me the members of IXyz and
    not IAbc and IDef.
    >
    Why?
    >
    TIA
    Let me see if I understand this:
    You have an interface named IXYZ that implements IABC and IDef

    public interface IABC
    {
    void MethodFromABC() ;
    }

    public interface IDef
    {
    void MethodFromIDef( );
    }

    public inteface IXYZ : IDef, IABC
    {
    void MethodFromIXYZ( );
    }

    Running reflection against IXY only returns MethodFromIXYZ( )?

    Is that correct?

    Comment

    • parez

      #3
      Re: question on inheritance of interfaces..

      On Mar 5, 8:18 pm, chrisro...@gmai l.com wrote:
      On Mar 5, 5:52 pm, parez <psaw...@gmail. comwrote:
      >
      I have interface IAbc,IDef
      >
      and interface IXyz inherits/implements(what is the right word) IAbc
      and IDef
      >
      if i reflect the type IXyz it only shows me the members of IXyz and
      not IAbc and IDef.
      >
      Why?
      >
      TIA
      >
      Let me see if I understand this:
      You have an interface named IXYZ that implements IABC and IDef
      >
      public interface IABC
      {
      void MethodFromABC() ;
      >
      }
      >
      public interface IDef
      {
      void MethodFromIDef( );
      >
      }
      >
      public inteface IXYZ : IDef, IABC
      {
      void MethodFromIXYZ( );
      >
      }
      >
      Running reflection against IXY only returns MethodFromIXYZ( )?
      >
      Is that correct?
      Correct...

      Comment

      • Ben Voigt [C++ MVP]

        #4
        Re: question on inheritance of interfaces..

        parez wrote:
        I have interface IAbc,IDef
        >
        and interface IXyz inherits/implements(what is the right word) IAbc
        and IDef
        >
        >
        if i reflect the type IXyz it only shows me the members of IXyz and
        not IAbc and IDef.
        >
        Why?
        Because you didn't use BindingFlags.Fl attenHierarchy
        >
        TIA

        Comment

        • parez

          #5
          Re: question on inheritance of interfaces..

          On Mar 6, 9:43 am, "Ben Voigt [C++ MVP]" <r...@nospam.no spamwrote:
          parez wrote:
          I have interface IAbc,IDef
          >
          and interface IXyz inherits/implements(what is the right word) IAbc
          and IDef
          >
          if i reflect the type IXyz it only shows me the members of IXyz and
          not IAbc and IDef.
          >
          Why?
          >
          Because you didn't use BindingFlags.Fl attenHierarchy
          >
          >
          >
          TIA
          can you please shed some more light on it..

          Comment

          • chrisrock2@gmail.com

            #6
            Re: question on inheritance of interfaces..

            On Mar 6, 10:08 am, parez <psaw...@gmail. comwrote:
            On Mar 6, 9:43 am, "Ben Voigt [C++ MVP]" <r...@nospam.no spamwrote:
            >
            >
            >
            >
            >
            parez wrote:
             I have interface IAbc,IDef
            >
            and  interface  IXyz inherits/implements(what is the right word) IAbc
            and IDef
            >
            if  i  reflect the type IXyz it only shows me the members of IXyz and
            not IAbc and IDef.
            >
            Why?
            >
            Because you didn't use BindingFlags.Fl attenHierarchy
            >
            TIA
            >
            can you please shed some more light on it..- Hide quoted text -
            >
            - Show quoted text -
            I don't think FlattenHierarch y works with interfaces. Found this on
            the MSDN boards:

            ShowInterfaceMe thods(typeof(my Interface));

            ShowInterfaceMe thods(Type iType)
            {


            foreach (MethodInfo mi in
            iType.GetMethod s(BindingFlags. Public | BindingFlags.In stance |
            BindingFlags.Fl attenHierarchy) )
            {

            Console.Writeli ne(mi.Name);
            }

            foreach (Type IBase in iType.GetInterf aces())
            {

            GetInterfaceMet hods(IBase);

            }

            }

            Comment

            • parez

              #7
              Re: question on inheritance of interfaces..

              On Mar 6, 10:08 am, parez <psaw...@gmail. comwrote:
              On Mar 6, 9:43 am, "Ben Voigt [C++ MVP]" <r...@nospam.no spamwrote:
              >
              >
              >
              parez wrote:
              I have interface IAbc,IDef
              >
              and interface IXyz inherits/implements(what is the right word) IAbc
              and IDef
              >
              if i reflect the type IXyz it only shows me the members of IXyz and
              not IAbc and IDef.
              >
              Why?
              >
              Because you didn't use BindingFlags.Fl attenHierarchy
              >
              TIA
              >
              can you please shed some more light on it..
              Thanks both.. .I got what i wanted..

              But is there a reason why I have to do that? Is it an oversight on ms
              side?

              Comment

              Working...