0

Why not just use the var keyword as the type of the parameters passed in the method? Then we could call the function passing arguments of whatever type we would like. Could that work?

5th May 2016, 2:40 PM
Konstantinos Mpoukouvalas
Konstantinos Mpoukouvalas - avatar
3 odpowiedzi
+ 6
As var is NOT a datatype in C# you cannot use it as a return parameter.
20th May 2016, 2:51 PM
James Flanders
+ 4
Essentially 'var' is just a way for the programmer to say: "Hey C# compiler, please figure out the real type of this variable and replace 'var' with it's actual type" var greeting = "bonjour"; compiles to the same object/IL code as: string greeting = "bonjour"; It is one of the 'syntactical sugar' constructs of the C# language that generally improves productivity. Ninjas don't like 'var'.
15th Jun 2016, 6:35 AM
Andre Sharpe
Andre Sharpe - avatar
- 2
This ketwird is only helper to ,creating the fields
28th Jul 2016, 5:08 AM
AHMBOH
AHMBOH - avatar