title: Adding additional attributes to each property of a class
body: <p>Say I have a class with any number of properties of any type</p>
  
  <pre><code>public class Test
  {
  public string A {get;set;}
  public object B {get;set;}
  public int C {get;set;}
  public CustomClass D {get;set;}
  }
  </code></pre>
  
  <p>I want all of the objects inside this class to have a notion of 'errors' and 'warnings'. For example, based on some condition in another class, I might want to set a warning on property A, and then display that information in the GUI. The GUI is not my concern; rather how should I set this warning? I would love to be able to do something like:</p>
  
  <p>For every property in a class, add a 'Warning' and 'Error' property such that I can do..</p>
  
  <pre><code>Test t = new Test();
  t.A.Warning = "This is a warning that the GUI will know to display in yellow".
  t.B.Error = null;
  </code></pre>
  
  <p>What is the best way to go about doing this? It would be nice if I could add a custom attribute to each property of the class that would add these additional properties and allow me to access them in a clear way. </p>
  
  <p>I have seen solutions that add a Dictionary to the parent class (Test), and then pass in strings that match the property names, or use reflection to get the property name and pass that in, but I would prefer something cleaner.</p>