coderushforroslyn-115577-code-style-assistance-code-formatters-sort-namespace-references.md
Sorts namespace references in the “using” (C#) or “Imports” (Visual Basic) section alphabetically or by length.
Available when the cursor is in a using ( Imports ) statement if the namespace references are not sorted.
Open the Editor | All Languages | Namespace References options page to configure this code formatter. For example, set the “Sort namespace references” option to “Alphabetically”.
Place the caret in a using ( Imports ) statement.
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;
Imports Mono.Cecil.Cil
Imports Mono.Cecil.Metadata
Imports Mono.Cecil.PE
Imports Mono.Collections.Generic
Imports System
Imports System.Collections.Generic
Imports System.IO
Imports System.IO.Compression
Imports System.Text
Imports System.UInt32
Note
This feature is available as a part of Code Cleanup.
See Also