Reflecting on Friend Properties...

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

    Reflecting on Friend Properties...

    Greetings All...

    I'm creating a BaseClass that will connect to a database and retrieve
    the all the properties values from it.

    So far so good. All the inherited classes retrieve it values from the
    database... IF the properties are PUBLIC.

    I'm using Reflection GetProperties and GetMemebers to retrieve the list
    of properties of each class.

    But in some classes I need that the BaseClass being able to see the
    Friend properties.

    Just to be on the same page... All classes are in a single Assembly,
    so, it SHOULD work.

    Does anyone know how to retrieve a list of Frined properties?

    I know it's possible because the Class Viewer shows everything... I
    just don't know how yet.

    Regards,

    Paulo

  • Oenone

    #2
    Re: Reflecting on Friend Properties...

    MstrControl wrote:[color=blue]
    > Does anyone know how to retrieve a list of Frined properties?[/color]

    At a guess, have you tried using the BindingFlags.No nPublic flag in your
    calls to GetProperties() and GetMembers()?

    --

    (O) e n o n e


    Comment

    • MstrControl

      #3
      Re: Reflecting on Friend Properties...

      Yep...

      No Good.. :-(

      Comment

      • adamsguitar@gmail.com

        #4
        Re: Reflecting on Friend Properties...

        Just a question: why not allow the child classes to, at the very most,
        provide the columns they wish to retrieve using either an overridden
        protected function or setting a property value? Reflection (used in
        this way) is an expensive set of operations.

        That being said, you just need to provide the appropriate binding flags
        to the GetProperties method. Since they're binary flags, you can
        specify more than one by either using + or (more generally accepted)
        the "or" operator. For example,

        ....GetProperti es(bindingflags .flag1 or bindingflags.fl ag2)

        none of those names are right, but it should show what I mean by using
        the or operator.

        You should include Public, NonPublic, Instance, and whichever other
        ones appeal to you.

        Comment

        Working...