[英]Search for name in all namespaces
Does Visual Studio provide a way to search down through each available namespace
for suggestions when The type or namespace name '____' could not be found
? 当
The type or namespace name '____' could not be found
时The type or namespace name '____' could not be found
Visual Studio是否提供一种在每个可用namespace
进行搜索的方法?
I often forget which namespace
to use for a particular object. 我经常忘记为特定对象使用哪个
namespace
。
For example, the code below does not compile, because I omitted using System.IO;
例如,下面的代码无法编译,因为我省略了
using System.IO;
. 。
using System;
namespace myTest {
class Program {
static void Main(string[] args) {
Stream fs = new Stream(); // <-- ERROR
}
}
}
Press CTRL + . 按CTRL + 。 to give you the option of adding the correct
using
statement (if the assembly is known) or prefixing the member with the relevant namespace. 使您可以选择添加正确的
using
语句(如果已知程序集)或为成员添加相关名称空间的前缀。
Click on the class that's in a different namespace, and you should see a blue square in the corner 单击不同名称空间中的类,您应该在角落看到一个蓝色正方形。
move your mouse over to that blue square, and an Icon should appear. 将鼠标移到该蓝色方块上,将出现一个图标。 click on that icon to have a list of options, one of them should be to add the appropriate namespace.
单击该图标以显示选项列表,其中之一应该是添加适当的名称空间。
It provides a floating helper if you hover over the unknown class that is in the referenced libraries. 如果将鼠标悬停在引用库中的未知类上,它将提供一个浮动帮助器。 Helper will suggest a namespace to add.
助手将建议添加一个名称空间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.