Method overloading

Joined
2/21/10
Messages
50
Points
18
Hello everybody!

Please explain me one issue in C#

If i have a method that takes 2 parameters X and Y and both can be either int type or double type at the same time or either int and either double.

Do I have to define the method in all the combination to get a full protection that the correct arguments are passed?


Thank you
 
It all depends on what you are going to do with function parameters. If the logic is the same then go with a double and then cast a variable before passing it into the function. Do not duplicate the logic. Remember, System.Object is the king.
 
Back
Top Bottom