ReSharper can replace fully qualified names with short names in C# and VB.NET code where possible by importing namespaces.
- Choose ReSharper | Options in the main menu.
- Open ReSharper | Options | Code Editing | C# | Namespace Imports (for C# settings) or ReSharper | Options | Code Editing | Visual Basic .NET | Namespace Imports (for VB.NET settings).
- You can choose to use fully qualified names always or to use short names with namespace imports. In the Reference Qualification section click Insert using directives when necessary or Use fully qualified names. Moreover, you can fine-tune replacing by selecting check boxes.
- Open the Code Cleanup options: ReSharper | Options | Code Editing | Code Cleanup.
- Create a new profile as described in Creating Custom Profiles. In the Selected profile settings section for the new profile, select Shorten qualified references check box.
- Click Save to apply the modifications and let ReSharper choose the settings layer, or choose a particular settings layer in the Save To drop-down list. To learn more about saving ReSharper settings, see JetBrains .NET Tools Blog: Save or Save To in ReSharper Options.
- Choose ReSharper | Tools | Cleanup Code in the menu to open the Code Cleanup dialog box for the current file or for a solution node (see Running Code Cleanup for details), and then select the newly created profile in the Available Profiles area.
- Click Run to perform Code Cleanup. ReSharper will shorten qualified references in the current file of in the selected solution node.
You can also shorten qualified references in the specific scope with the Fix in Scope.
This feature is supported in the following languages/technologies:
The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see the corresponding topics in the ReSharper by Language section.