Is there a cost associated with overloading methods in .Net?
So if I have 3 methods like:
Calculate (int)
Calculate (float)
Calculate (double)
and these methods are called at runtime "dynamically" based on what's passed to the Calculate method, what would be the cost of this overload resolution?
Alternatively I could have a single Calculate and make the difference in the method body, but I thought that would require the method to evaluate the type every time it's called.
Are there better ways/designs to solves this with maybe no overhead? Or better yet, what's the best practice to handle cases like these? I want to have the same class/method name, but different behaviour.
EDIT: Thanks all. Jusdt one thing if it's any different. I was wondering say you have a DLL for these methods and a program written in C# that allows the user to add these methods as UI items (without specifying the type). So the user adds UI item Calculate (5), and then Calculate (12.5), etc, and the C# app executes this, would there still be no overhead?