title: Overriding a property with an attribute
body: <p>I'm trying to find a way to change the serialization behavior of a property.</p>
  
  <p>Lets say I have a situation like this:</p>
  
  <pre><code>[Serializable]
  public class Record
  {
     public DateTime LastUpdated {get; set; }
  
     // other useful properties ...
  }
  
  public class EmployeeRecord : Record
  {
     public string EmployeeName {get; set; }
  
     // other useful properties ...
  }
  </code></pre>
  
  <p>Now I want to serialize EmployeeRecord. I don't want the LastUpdated property from the Record class to be serialized. (I do want LastUpdated to be serialized when I serialize Record, though).</p>
  
  <p>First I tried hiding the LastUpdated property by using the <em>new</em> keyword and then adding the XmlIgnore attribute:</p>
  
  <pre><code>public class EmployeeRecord : Record
  {
     public string EmployeeName {get; set; }
  
     [XmlIgnore]
     public new DateTime LastUpdated {get; set; }
     // other useful properties ...
  }
  </code></pre>
  
  <p>But that didn't work.  Then I tried making the base LastUpdated virtual and overriding it, keeping the attribute:</p>
  
  <pre><code>[Serializable]
  public class Record
  {
     public virtual DateTime LastUpdated {get; set; }
  
     // other useful properties ...
  }
  
  public class EmployeeRecord : Record
  {
     public string EmployeeName {get; set; }
  
     [XmlIgnore]
     public override DateTime LastUpdated {get; set; }
     // other useful properties ...
  }
  </code></pre>
  
  <p>This didn't work either. In both attempts the LastUpdated ignored the XmlIgnore attribute and happily went about its business of serializing.</p>
  
  <p>Is there a way to make what I'm trying to do happen?</p>