title: Generic Extension method in C#
body: <p>I have different List of Custom class. and need to check for the properties of String type and validate the value of the property. if has some thing wrong value then change the value with some predefined value. 
  For this I thought to create a Generic method of 
  public IEnumerable validate (this IEnumerable ListofData) </p>
  
  <p>but now I am unable to traverse on the properties and check the value and return the same after manipulating. 
  Please find the sample code.</p>
  
  <p>Thanks.</p>
  
  <pre><code> public static  class ValidateExt
  {
     public static IEnumerable&lt;T&gt; ValidateStringData&lt;T&gt;(this IEnumerable&lt;T&gt; DataList)
     {
         PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(typeof(T));
         foreach(T Item in DataList)
         {
             // here want to manipulate the date of those properties which is of string type and assign it back.
         }
     }
  }
  </code></pre>