标签云

微信群

扫码加入我们

WeChat QR Code


var (as answered many times before) is syntactic sugar; it saves the coder typing characters that's all. At compile time the actual assigned type is used. It is not at all like 'dynamic'

2018年10月21日35分12秒

For strongly-typing(?)

2018年10月21日35分12秒

Are you asking why C# is strongly-typed?

2018年10月21日35分12秒

Well the actual reason would be it all started from 1.0 and not 3.0

2018年10月21日35分12秒

Alex var i = 5 and int i = 5 are equally strongly typed

2018年10月22日35分12秒

+1 because I'am one of people who like write types :)

2018年10月22日35分12秒

And you can't use var to specify lambdas. i.e var a = () => {}; won't work (but you can type var a = () => {} as Action ;) )

2018年10月21日35分12秒

you can only use var in method variables - not fields, parameters, return types etc is my real answer.

2018年10月21日35分12秒