Extension Methods in .NET(cheraq.com)

submitted by mostafafnmostafafn(50) 2 years, 8 months ago

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.

add a comment |category: |Views: 9

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

No comments so far

information Login or create an account to comment on this story