Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,
Is it possible to have two methods with the same name and parameters but each return a different datatype?

i.e.
C#
private string executescalar(string param1)
{
...
return string
}

private datetime executescalar(string param1)
{
...
return datetime
}
Posted

Simple answer No, it's not possible.
 
Share this answer
 
In C# you are not permitted to overload on return value, this can only be done on the parameters of a function.
The compiler will give a error when you try it.
 
Share this answer
 
v2
Comments
arkiboys 18-Oct-11 10:20am    
Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900