Is there a way in Visual Studio (a hotkey) to automatically import a type (or choosing between known namespaces) like the Ctrl + O in Eclipse?
You can turn this option on in Tools > Options > Text Editor > C# > Intellisense. If you select a suggested type from the intellisense list the necessary import is automatically added to your file.
Import a class by using a quick fixPress Alt+Enter and accept the suggestion to import the namespace where the declaration of the class is detected. PhpStorm inserts a namespace declaration statement ( use statement).
Yes, Visual Studio can add the using
for 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 using
at the top of the file for the namespace of that class. I use it all the time.
This is easier than Shift + Alt + F10 + Enter as it's fewer keys and the . and Enter are closer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With