Is it possible to write in C# method in such a way that when I write
String contestId = getParameter("contestId")
i get contestId in string, but when I write:
int contestId = getParameter("contestId")
i get contestId parsed to integer?
This is only simple example showing what i try to achieve.
Nope it’s not possible to overload methods solely based on their return type. You could, however, introduce a generic parameter:
And if you were using C# 3.0 you could use this method as:
thus saying the actual type only once.