var关键字运行时或编译时间?

Dar*_*der 6 .net c# variables

var关键字在运行时或编译时获取类型?

或取决于?

Len*_*rri 17

Plain and simple: compile time

var isn't a type. The actual type is figured out at compile-time.

var variables are also known as Implicitly Typed Local Variables (C# Programming Guide)

  • 您应该在C#4.0中检查新的`dynamic`关键字.http://msdn.microsoft.com/en-us/library/dd264736.aspx (2认同)