In C#, we have var
data type but we can\'t use it as functions return type.
Why this is not possible?
public var myFunction()
{
var = s
var
is NOT a datatype in C#. That's why you cannot use it as a return parameter. The compiler infers the type at compile time from the right handside of the assignment and bearing in mind that it is known at compile time you need to use the real type as return value. In C# 4.0 you could use the dynamic type:
public dynamic myFunction()
{
var = some operations
}