Hide a property in inherited class

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello,
Can somebody explain to me how can I hide a public property in a inherited class?

I saw in some topics about using [Browsable(false)] attribute for the specified property, but it seems do not work for all the cases:

<div style="text-align:left

<div style="text-align:left    
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Block
public partial class LabeledTextBox : UserControl
    {
        <span style="color:rgb(51,153,102) // try to hide the Width public property

        [Browsable(<span style="color:rgb(51,102,255) false)]


<span style="color:rgb(51,102,255)         public new int Width
        {
            get { return base.Width; }
        }  
    }

    class MyTestClass
    {
        LabeledTextBox ltb;
        public MyClass()
        {
            ltb.Width; <span style="color:rgb(51,153,102) // Width is visible
        }
       
    }



View the full article
 
Back
Top