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
Depending on your
- Start typing a name in the editor. If the name references a class that lacks a namespace import directive, the following
pop-up window displays:
- 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 required type:
For guidelines on how to import a type with a quick-fix, see
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.