Re: BindingFlags.Internal, where is that?
From: TEK (trondeirikkolloen_at_hotmail.com)
Date: 11/25/04
- Next message: msuk: "CssClass and HTML filefiled control"
- Previous message: Jon Skeet [C# MVP]: "Re: Where is the good old Friend statement?"
- In reply to: Ian Griffiths [C# MVP]: "Re: BindingFlags.Internal, where is that?"
- Next in thread: Ian Griffiths [C# MVP]: "Re: BindingFlags.Internal, where is that?"
- Reply: Ian Griffiths [C# MVP]: "Re: BindingFlags.Internal, where is that?"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 25 Nov 2004 16:32:42 +0100
Hello
Thanks for the reply.
Futher investigation shows that the problem only shows itself if the
internal member is declared in a base class.
Meaning that using:
And having a base class that declares a property as internal causes the call
below (not actual code) to return null instead of the property.
myType.GetProperty(myObject, "MyProperty", BindingFlags.NonPublic |
BindingFlags.Public | BindingFlags.Instance)
Changing the property to public or making the call directly on the base
class type makes it return the property.
(I have not tested changing the type to protected or private)
Is this a bug?
Regards, TEK
"Ian Griffiths [C# MVP]" <ian-interact-sw@nospam.nospam> skrev i melding
news:<u3q$ezt0EHA.1408@TK2MSFTNGP10.phx.gbl>...
> "TEK" <trondeirikkolloen@hotmail.com> wrote:
> > But how the heck do I get access to the Internal methods???
> > Specifying BindingFlags.Public | BindingFlags.NonPublic causes the
> > internal methods to not be found.
>
> NonPublic gets you all the non-public members (hence the name). This
> includes internal members.
>
> The documentation neglects to include internal members in its list of what
> constitutes non-public, but in practice, NonPublic gets you all the
> non-public members.
>
> --
> Ian Griffiths - http://www.interact-sw.co.uk/iangblog/
> DevelopMentor - http://www.develop.com/
>
>
- Next message: msuk: "CssClass and HTML filefiled control"
- Previous message: Jon Skeet [C# MVP]: "Re: Where is the good old Friend statement?"
- In reply to: Ian Griffiths [C# MVP]: "Re: BindingFlags.Internal, where is that?"
- Next in thread: Ian Griffiths [C# MVP]: "Re: BindingFlags.Internal, where is that?"
- Reply: Ian Griffiths [C# MVP]: "Re: BindingFlags.Internal, where is that?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|