找不到类型或命名空间名称'var'(您是否缺少using指令或程序集引用?) [英] The type or namespace name 'var' could not be found (are you missing a using directive or an assembly reference?)

查看:66
本文介绍了找不到类型或命名空间名称'var'(您是否缺少using指令或程序集引用?)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我收到错误,当我在项目中使用'var'关键字时,错误应该是这样的,但我不知道如何要解决这个问题,请帮助我,如果有任何人知道这个答案,给定的代码是我已经跟随我的项目...



var fromAddress =;

var toAddress =;





感谢提前......

解决方案

var (您似乎使用的是2.0)。


Var 是.net 3.5增强功能。你可能想查看你正在使用的.net版本。



祝你好运!


解决方案可能很简单:

  string  fromAddress =  ; 
string toAddress = ;





我知道当对象名称为时,我们尝试使用 var 很长很复杂。

但我觉得很愚蠢,人们试图通过在任何地方使用 var 关键字来打败C#语言的强类型方向。


hi all,

I got an error,when am using 'var' keyword in my project, the error should be like this, but i dont know how to resolve this problem, please help me if any one known this answer , the given code is i have follow in my project...

var fromAddress = "";
var toAddress = "";


thanks to advance...

解决方案

var was added in C# 3.0 (you seem to be using 2.0).


Var is a .net 3.5 enhancement. You might want to check the .net version you are using.

Good luck!


Solution could be simple:

string fromAddress = "";
string toAddress = "";



I understand that we try to use var when object names are quite long and complicated.
But I find silly that people try to defeat the strongly-typed orientation of the C# language by using var keyword anywhere.


这篇关于找不到类型或命名空间名称'var'(您是否缺少using指令或程序集引用?)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆