title: How to get and modify a property value through a custom Attribute?
body: <p>I want to create a custom attribute that can be used on a property like:</p>
  
  <pre><code>[TrimInputString]
  public string FirstName { get; set; }
  </code></pre>
  
  <p>that will be functional equivalent of</p>
  
  <pre><code>private string _firstName
  public string FirstName {
    set {
      _firstName = value.Trim();
    }
    get {
      return _firstName;
    }
  }
  </code></pre>
  
  <p>So basically every time property is set the value will be trimmed.</p>
  
  <p>How do I get the value parsed, modify that value and then set the property with the new value all from within the attribute?</p>
  
  <pre><code>[AttributeUsage(AttributeTargets.Property)]
  public class TrimInputAttribute : Attribute {
  
    public TrimInputAttribute() {
      //not sure how to get and modify the property here
    }
  
  }
  </code></pre>