?
Solved

Extension in .net

Posted on 2009-07-13
10
Medium Priority
?
173 Views
Last Modified: 2013-11-08
Hi

I have read this question in an interview site

What is the extension in .net

Can you tell me the white papers from where I can read it
0
Comment
Question by:KaranGupta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
10 Comments
 
LVL 12

Expert Comment

by:GuitarRich
ID: 24837890
what extension is it talking about? file extension, ajax extentions? that question on its own is a bit ambiguos to me...
0
 

Author Comment

by:KaranGupta
ID: 24837896
Apart from ajax extension

is there any extension in .net
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 24837899
Extension methods are a great new way of adding functionality to an existing type  even a type you dont have the source code to modify that type. This article explains extension methods and provides clear examples along with pros and cons.
http://www.eggheadcafe.com/tutorials/aspnet/ce4969c5-b20a-42b4-82cf-3344eff69311/c-net-extension-methods.aspx
0
Basic Security of Your VPC

So, you’ve got this shiny new VPC and a fancy new application configured on your EC2 servers ready to go. This application is only accessible from your computer, which is great for security, but you need your users to be able to access it! So, what’s the easiest way to do this?

 
LVL 53

Accepted Solution

by:
Dhaest earned 2000 total points
ID: 24837904
0
 

Author Comment

by:KaranGupta
ID: 24837974
Hi

I was studying it

http://www.dotnetfunda.com/articles/article445-extension-method-net-35-and-above.aspx

but there is a query

if a function is passing 2 parameters then how we will call this function
0
 

Author Comment

by:KaranGupta
ID: 24846311
Hi

Any updates on this
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 24846536
>> if a function is passing 2 parameters then how we will call this function

What do you mean exactly ?


string s = "Hello Extension Methods";
string strReverse = s.Reverse (strReverse, 10);
 
public string Reverse(String strReverse, int MaxLength)
{
    ...
}

Open in new window

0
 

Author Comment

by:KaranGupta
ID: 24846548
Hi

I got my answer, but one more thing I want to ask is,

where is this statement justified

Extension method allows you to add new method to the existing class without modifying the code, recompiling or modifying the original code.

because we can attain the same result by using function overload.

What additional benefit do the developers have for using this function
0
 

Author Comment

by:KaranGupta
ID: 24866929
HI

ANy updates
0
 
LVL 12

Expert Comment

by:GuitarRich
ID: 24867905
you should really assign the points to this question and open a new one. But...
Overloading is different. Overloading allows you to create the same method name with different parameters e.g
public void DoSomething() { }
public void DoSomething(int aParameter) {}
etc....
Extension methods allow to to add methods to existing classes without having access to that classes source code. e.g you can add methods to the string object which is a build in class in the .net framework.
Overloading & Extensions are not the same.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question