interviews.dotnetthread.com

↑ Grab this Headline Animator

Friday, October 3, 2008

Extension Methods in C# 3.0 with Example.

Allows you to write methods associated with classes other than the class in which they are declared.
The extension method must be declared static.
The class in which the extension method is declared must also be declared static.
The extension method must contain as its first parameter type the keyword this, followed by the name of the class it is extending.

Example:

Submit this story to DotNetKicks

No comments:

Post a Comment

Post your comments/questions/feedback for this Article.

 

Latest Articles