Go to DotNetFunda.com
 Welcome, Guest!  
LoginLogin  
Expose your profile for FREE in Xpose
Submit: Article | Interview Question | Code | Question | Xpose | Joke | Link || Search  
 Skip Navigation Links Home > Interview/Exam Questions > What is extension method in C#? ...


CSS Interview Question

What is extension method in C#?

Author: Raja | Posted on: 11/13/2008 6:17:18 PM | Category: CSS | Views:262 |  Print Asked In: Many Interviews


Answer:
Extension method is a new feature in C# 3.0.

Extension methods allow existing classes to be extended without relying on inheritance or having to change the class's source code. This means that if you want to add some methods into the existing String class you can do it quite easily.

Here's a couple of rules to consider when deciding on whether or not to use extension methods:

* Extension methods cannot be used to override existing methods
* An extension method with the same name and signature as an instance method will not be called
* The concept of extension methods cannot be applied to fields, properties or events
* Use extension methods sparingly....overuse can be a bad thing!

For more details, see http://weblogs.asp.net/dwahlin/archive/2008/01/25/c-3-0-features-extension-methods.aspx

Interesting?  Bookmark and Share


Navigate to:

<< Previous Question: Menton the events in page life cycle and explain them.

Next Question >>: What is endpoint in WCF?

Random Questions: Random Interview Questions

Help: If for some reason you are getting the same question by clicking Next and Previous, Try clicking Random Question or Category link above.

About Us | Contact Us | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
All rights reserved to DotNetFunda.Com. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks.
(Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher)