How are inherited methods/properties hidden?

  • Thread starter Thread starter Sam Sungshik Kong
  • Start date Start date
S

Sam Sungshik Kong

Hello!

While using panel control, I wondered a thing.
Panel class is subclass of Control class.
Control class has KeyPress event and Focus() method, etc...
Then Panel class must have them.
I guess it *has* then behind even if they are not meaningful.
However, the code complete tool doesn't show them when I type panel1.(code
complete list).
Actually I can type panel1.Focus() without any compilation error.
It has no effect, thought.

What's going on?
Is it VS function or language feature to hide the meaningless
methods/proeprties?

Thanks.

Sam
 
Sam,

None of the methods should be hidden. You should see all of the
methods/properties/events of the Control class (assuming they are public).

Hope this helps.
 
Nicholas,

Thanks for your reply.

I know that methods shouldn't be hidden.
What I want to know is how the code complete tool knows which methods are
meaningless.

You try the following:

panel1. <= only some of methods/properties of Panel class are shown.
((Control)panel1). <= all of methods/properties of Control class are shown.

As Panel class is a subclass of Control class, the methods/properties of
Panel class must include all methods/properties of Control class.
However, some of them are missing in the code complete tool, which is very
tricky and useful.

Could you explain how it works?

Sam
 
It is set by the attributes of the methods / properties like this

[
Browsable(false), // will hide it from the properties pane
EditorBrowsable(EditorBrowsableState.Never) // will hide it from
intellisense
]

You can still access these properties by typing it into the code but they
will not show up in intellisense etc..

HTH
JB
 
Back
Top