我应该在使用名称空间输入什么? [英] What should I type in using namespace?

查看:83
本文介绍了我应该在使用名称空间输入什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误1找不到类型或名称空间名称"DataAccessComponent"(您是否缺少using指令或程序集引用?)C:\ Documents and Settings \ Ben \ My Documents \ Visual Studio 2008 \ Projects \ Connections \ Connections \ Program.cs 17 13 Connections

Error 1 The type or namespace name ''DataAccessComponent'' could not be found (are you missing a using directive or an assembly reference?) C:\Documents and Settings\Ben\My Documents\Visual Studio 2008\Projects\Connections\Connections\Program.cs 17 13 Connections

推荐答案

您正在使用哪个Data Access.您需要在代码顶部添加名称空间,如下所示.我不知道您的代码,所以请不要从字面上理解.

Which Data Access are you using. you need to add the name space at the top of your code, something like this. I don''t know your code so don''t take this literally.

using System.Data;



要获得要使用的确切名称空间,请向您显示代码或从MSDN中找出代码.如果它是第三方工具,则需要弄清楚要包括哪个名称空间.



To get an exact namespace to use, show you your code or figure it out from MSDN. If it is third party tool, you need to figure out which namespace to include.


它不仅是使用",还包括1)引用了一些程序集,2 )查看您引用的程序集的类型声明所使用的名称空间,3)在代码中添加适当的"using"子句.

使用Visual Studio,可以在解决方案资源管理器"中打开项目的引用"节点,如果尚未添加引用,则单击它,然后单击引用程序集的树节点.在文档视图中,您可以浏览有问题的部件并找出所有名称空间.

另外,可以在运行时使用类System.Reflection.Assembly的方法加载程序集.
如果这不是.NET程序集,则应使用P/Invoke.

—SA
It''s not just "using", it''s 1) having some assembly referenced, 2) looking at the name space(s) used by the type declarations of the assembly you reference, 3) adding appropriate "using" clauses to your code.

With Visual Studio, you can open you project''s References node in Solution Explorer, add the reference if you did not do it yet and then click on the tree node of the referenced assembly. In the document view you can browse the assembly in question and find out all the name spaces.

Also, an assembly can be loaded during run-time using methods of the class System.Reflection.Assembly.

If this is not a .NET assembly, P/Invoke should be used.

—SA


如果它不是.NET组件,是否确定引用中的dll位于您的参考文件中?您可能需要在此处添加它.
If it is not a .NET componant, have you made sure the dll that contains this is in your References? You may need to add it there.


这篇关于我应该在使用名称空间输入什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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