visual-studio 自动命名空间导入
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/186895/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Automatic namespaces import
提问by Enrico Murru
Is there a way in Visual Studio (a hotkey) to automatically import a type (or choosing between known namespaces) like the Ctrl+ Oin Eclipse?
Visual Studio(热键)中是否有办法自动导入类型(或在已知命名空间之间进行选择),例如Eclipse 中的Ctrl+ O?
采纳答案by Larry
回答by mattlant
Yes, Visual Studio can add the usingfor you. When you type in a class name, hit Ctrl+ .and then Enter(the first option is 99.99% the right one, so just hit Enter). And you can have it add the usingat the top of the file for the namespace of that class. I use it all the time.
是的,Visual Studio 可以using为您添加。当你输入一个类名时,点击Ctrl+.然后Enter(第一个选项是 99.99% 是正确的,所以只需点击Enter)。您可以让它using在该类的命名空间的文件顶部添加。我用它所有的时间。
This is easier than Shift+ Alt+ F10+ Enteras it's fewer keys and the .and Enterare closer.
这比Shift+ Alt+ F10+更容易,Enter因为它的键更少,并且.和Enter更接近。
回答by Andrew
Look at JetBrain'sexcellent ReSharperproduct. It does this for you.


