Are there any costs associated with overloading methods in .Net?
So, if I have 3 methods like:
Calculate (int)
Calculate (float)
Calculate (double)
and these methods are called "dynamically" at runtime based on what is passed to the Calculate method, what will the cost of this overload resolution be?
Alternatively, I could have one Calculate and make changes to the body of the method, but I thought it would require the method to evaluate the type every time it called.
Are there any better ways / projects to solve this, maybe not overhead? Or better yet, which is best suited for such cases? I want to have the same class / method name, but different behavior.
EDIT: Thanks to everyone. Jusdt is one thing if it is another. I was wondering if you have a DLL for these methods and a program written in C # that allows the user to add these methods as user interface elements (without specifying a type). So the user adds the UI element Calculate (5) and then Calculate (12.5), etc., And the C # application does this, will there be overhead?
source
share