Error!
Success!

Extension Methods in .NET

0
kicks

Extension Methods in .NET  (Unpublished)

Extension methods enable you to "add" methods to existing types without creating a new derived type, recompiling, or otherwise modifying the original type. The advantage of extension methods are, they will be available on all objects derived from that type. So if you add an extension method to string class, then it will be available on all string objects. Let’s see how we will implement extension methods. Again MSDN says: Extension methods are defined as static methods but are called by using instance method syntax. Their first parameter specifies which type the method operates on, and the parameter is preceded by the this modifier. Extension methods are only in scope when you explicitly import the namespace into your source code with a using directive.


Kicked By:
Drop Kicked By: