title: C# Reflection : Finding Attributes on a Member Field
body: <p>I may be asking this incorrectly, but can/how can you find fields on a class within itself... for example...</p>
  
  <pre><code>public class HtmlPart {
    public void Render() {
      //this.GetType().GetCustomAttributes(typeof(OptionalAttribute), false);
    }
  }
  
  public class HtmlForm {
    private HtmlPart _FirstPart = new HtmlPart();      
    [Optional] //&lt;-- how do I find that?
    private HtmlPart _SecondPart = new HtmlPart();
  }
  </code></pre>
  
  <p>Or maybe I'm just doing this incorrectly... How can I call a method and then check for attributes applied to itself?</p>
  
  <p><strong>Also, for the sake of the question</strong> - I'm just curious if it was possible to find attribute information <em>without knowing/accessing the parent class!</em></p>