可能重复:
What's the point of the var keyword?
What advantages does using var have over the explicit type in C#?为什么使用var而不是类名?
我总是看到别人产生类似的代码:
VAR SMTP =新SmtpClient();
但是为什么在这种情况下使用var
而不是SmtpClient
?我ALWAYS使用
SmtpClient SMTP =新SmtpClient();
是var
更有效吗?为什么使用var
而不是实际的变量类型?我错过了什么吗?
可能的重复[使用var有什么优势超过显式类型在C#?](http://stackoverflow.com/questions/3425966/what-advantages-does-using-var-have-over-the-显式类型在C)另请参见[C#'VAR'与特定类型的性能](http://stackoverflow.com/questions/356846/c-sharp-var-vs-specific-type-performance) –
@MattBall大声笑和**这是**一个重复也 –