An interesting feature of the .NET Framework 3.5 is that any set of methods available on an instance of a particular type is open to extension. Effectively, adding new methods to existing types is now possible.By using extension methods, we can declare static methods that can be invoked using the instance method syntax. In order to declare an extension method we must specify the keyword this as the first parameter of the static method.
Let’s show an example:
1. We have a Customer class, which needs of another method “Logout”:
2. Instead of using an inherited class, we add the “Logout” method to our Customer class by declaring a static method which can be invoked directly in any Customer class instance.
3. Finally, in our code we can invoke our “Logout” extension method in this way:

When extension methods are consumed, the argument that was declared with the keyword this is not passed, while all other arguments will be passed and seen by intellisense. So, the first argument in the declaration (keyword this) allows the compiler to determine the class instances on which the extension method is called.
Remember that extension methods, though declared as static, can be called only on instances values!!!






