When you reference a type that has not been imported yet, ReSharper helps you locate this type and add it to the list of namespace import directives. The new directive is added to the list, but the caret stays in the current position, and your editing session is not interrupted.
It is important to note that "using" directives are added in alphabetical order: all System.* namespaces go first, sorted alphabetically by the second word after dot; all the rest namespaces go next, in alphabetical order.
Depending on your code inspection settings, the prompt to add a directive appears as a pop-up window or as a quick-fix. You can also opt to resolve references to non-imported types with either using directives or fully qualified names. For the list of available options, see C# Namespace Imports.
Start typing a name in the editor. If the name references a class
that lacks a namespace import directive, the following pop-up window
Press Alt+Enter. If there's a single choice, the
namespace will be imported right away. If there are multiple
choices, a drop-down list will display where you can select a
For guidelines on how to import a type with a quick-fix, see Examples of Quick-Fixes: Missing Using Directives.
When you paste a large block of code, a lot of types may not resolve because of missing namespace import directives in the current file. To simplify the task of adding all required directives, ReSharper provides a prompt.
- Paste a block of code into the desired file.
If the block of code contains types that lack namespace import directives,
the following pop-up prompt displays.
- Press Alt+Enter or click to insert all required namespace import directives.