Usage of Extension Methods in C# 3.5

Jun 16 2010 9:39 AM
Introduction: C# 3.0 provides a new feature called Extension Methods.  Extension methods are methods that can be added to previously defined classes without rebuilding/compiling those classes.
 
Process: To define an extension method, we first define a static class, Then we define our static method which is meant to be extended. The first parameter of the extension class should be the type of Object we need to extend.
 
Syntax:
public static <Return Type> <Function Name>(this <Object Type> <Variable Name>)
{
        Do Something
         .........
         ......
         return <Return Type> ;
}

Hope you find this tips useful.

Thanks,
Bijayani