views:

93

answers:

3

I like to overload methods to support more and more default cases. What is the performance impact of method overloading? From your experience, is it advisable to overload methods? What is the limit? What are the workarounds?

+7  A: 

Overloading has no impact on performance; it's resolved by the compiler at compile-time.

As for design guidance, see the design guidelines:

http://msdn.microsoft.com/en-us/library/ms229029.aspx

Brian
great! just need a compromise between code readability and code usability..
Raze2dust
+2  A: 
  1. Performance impact, as far as I know, it's like defining a new method. The performance impact is space on your harddrive.
  2. Advisable to overload methods, Definitely, it's provides convenience
  3. What is the limit, As much Harddrive space as you have.
PieterG
Don't forget the memory use, because the methods will be JITted ;-)
Steven
+5  A: 

If you're using C# 4.0 you can save your fingers some work and use optional parameters.

Andy Gaskell
ah.. i'm on 3.5 :(
Raze2dust