title: Attributes in .net
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2295119/when-should-i-use-attribute-in-c">When should I use attribute in C#?</a>  </p>
  </blockquote>
  
  
  
  <p>Hi, I am trying to understand how Attributes in .net works.</p>
  
  <p>As we all know Attributes are of two types metadata and context attributes.</p>
  
  <p>Metadata attributes:  it allows some data to be attached to a class or method. This data becomes part of the metadata for the class, and  can be accessed via reflection.</p>
  
  <p>Firstly, why do we need custom attributes please give examples and How is that information attached with that class and how will it be interpreted.</p>
  
  <p>Custom attributes: Please explain this and explain the flow how is that custom class which is derived System.Attribute is executed and how will that information be useful to the current class or method which uses that attribute. (best example is Validation Block is applied as attributes to the property or methods and it will be automatically validated. how is this possible).</p>
  
  <p>I have the basic understanding of attributes and how it works and looking at the process how that works. </p>
  
  <p>Thanks in advance.</p>