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?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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
回答2:
If you're using C# 4.0 you can save your fingers some work and use optional parameters.
回答3:
- Performance impact, as far as I know, it's like defining a new method. The performance impact is space on your harddrive.
- Advisable to overload methods, Definitely, it's provides convenience
- What is the limit, As much Harddrive space as you have.