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
?
I often forget which namespace
to use for a particular object.
For example, the code below does not compile, because I omitted using System.IO;
.
using System;
namespace myTest {
class Program {
static void Main(string[] args) {
Stream fs = new Stream(); // <-- ERROR
}
}
}
Press 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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.