Sort Namespace References
- 2 minutes to read
Purpose
Sorts namespace references in the “using” (C#) or “Imports” (Visual Basic) section alphabetically or by length.
Availability
Available when the cursor is in a using (Imports) statement if the namespace references are not sorted.
Usage
Open the Editor | All Languages | Namespace References options page to configure this code formatter. For example, set the “Sort namespace references” option to “Alphabetically”.
For more information about Sort Namespace References options, refer to the following topic: Namespace References Settings.
Place the caret in a using (Imports) statement.
Note
The blinking cursor shows the caret’s position at which the Code Formatter is available.
- Press the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions menu.
Select Sort Namespace References from the menu.
After execution, the Code Formatter sorts the namespace references alphabetically.
using Mono.Cecil.Cil;
using Mono.Cecil.Metadata;
using Mono.Cecil.PE;
using Mono.Collections.Generic;
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Text;
using System.UInt32;
Note
This feature is available as a part of Code Cleanup.