ReSharper Web Help

ReSharper | Options | Languages | C# | Namespace Imports

This tab contains options that affect the way ReSharper optimizes namespace import directives and resolves references to namespaces when applying quick-fixes or completing the code .

Item Description

Reference Qualification

Options in this section define whether ReSharper should resolve references with namespace import directives or fully qualified names.

Insert using directives when necessary

Click this radio button to create namespace import directives when referencing a type that has not been imported.

Add using directive to the deepest scope

If this check box is selected, namespace import directives are added inside of the namespace.

Prefer fully qualified using name at nested scope

If this check box is selected, fully qualified names for namespace imports are preferred at nested scope.

Allow the alias using directive

Selecting this check box allows using non-trivial names for namespace import directives.

Use fully qualified names

Click this radio button to add a fully qualified path to each unresolved reference.

Allow the 'global::' prefix

If this check box is selected, the global:: prefix is automatically added to references, as in global::System.String.

Imports Optimization

This section helps configure how ReSharper should handle namespace import directives when it's optimizing code.

Do not remove using alias directives if alias name differs from the imported type name

If this check box is selected, ReSharper never removes non-trivial alias using directives from the source code, even though they are redundant. If it is cleared, ReSharper removes all redundant using directives.

Namespaces that should not be removed

In this text box, you can list namespaces that ReSharper will not highlight as redundant, and will not remove while optimizing code.

Use the Add Add button to add an entry to the list and specify the namespace.

Use the Edit button to edit a namespace entry.

Use the Remove button to delete a selected entry from the list.

Namespaces that should be always imported

In this text box, you can list namespaces that ReSharper should always import while optimizing code by inserting corresponding directives.

Use the Add Add button to add an entry to the list and specify the namespace.

Use the Edit button to edit a namespace entry.

Use the Remove button to delete a selected entry from the list.

See Also

Procedures