title: Extending ASP.NET WebControls: How to effectively hide public properties
body: <p>I am extending TextBox WebControl to work as a sort of "DateTextBox" which exposes it's value as a property (<code>DateValue</code>) in the code-behind:</p>
  
  <pre><code>public sealed class DateTextBox : TextBox
  {
      public DateTime ?DateValue
      {
          /* ToDateFromUserInterface() and ToUserInterfaceString() are both
             extension methods */
  
          get
          {
              return
              (
                  String.IsNullOrEmpty(Text) ?
                  new DateTime?() :
                  Text.ToDateFromUserInterface()
              );
          }
  
          set
          {
              if (value != null) Text = ((DateTime)value).ToUserInterfaceString();
          }
      }
  }
  </code></pre>
  
  <p>Given the fact that this control is only supposed to be used with dates, there's no reason for it to inherrit the <code>Text</code> property from it's parrent.</p>
  
  <p>Is there any way to hide it?.. Other than implementing a <code>NotImplementedException</code>, like so:</p>
  
  <pre><code>new public String Text
  {
      get { throw new NotImplementedException(); }
      set { throw new NotImplementedException(); }
  }
  </code></pre>