title: C# "Rename" Property in Derived Class
body: <p>When you read this you'll be awfully tempted to give advice like "this is a bad idea for the following reason..."</p>
  
  <p>Bear with me.  I know there are other ways to approach this.  This question should be considered trivia.</p>
  
  <p>Lets say you have a class "Transaction" that has properties common to all transactions such as Invoice, Purchase Order, and Sales Receipt.</p>
  
  <p>Let's take the simple example of Transaction "Amount", which is the most important monetary amount for a given transaction.</p>
  
  <pre><code>public class Transaction
  {
      public double Amount { get; set; }
  
      public TxnTypeEnum TransactionType { get; set; }
  }
  </code></pre>
  
  <p>This Amount may have a more specific name in a derived type... at least in the real world.  For example, the following values are all actually the same thing:</p>
  
  <ul>
  <li>Transaction - Amount</li>
  <li>Invoice - Subtotal</li>
  <li>PurchaseOrder - Total</li>
  <li>Sales Receipt - Amount</li>
  </ul>
  
  <p>So now I want a derived class "Invoice" that has a Subtotal rather than the generically-named Amount.  Ideally both of the following would be true:</p>
  
  <ol>
  <li>In an instance of Transaction, the Amount property would be visible.</li>
  <li>In an instance of Invoice, the Amount property would be hidden, but the Subtotal property would refer to it internally.</li>
  </ol>
  
  <p>Invoice looks like this:</p>
  
  <pre><code>public class Invoice : Transaction
  {
      new private double? Amount
      {
          get
          {
              return base.Amount;
          }
          set
          {
              base.Amount = value;
          }
      }
  
      // This property should hide the generic property "Amount" on Transaction
      public double? SubTotal
      {
          get
          {
              return Amount;
          }
          set
          {
              Amount = value;
          }
      }
  
      public double RemainingBalance { get; set; }
  }
  </code></pre>
  
  <p>But of course Transaction.Amount is still visible on any instance of Invoice.</p>
  
  <p>Thanks for taking a look!</p>