The requested page is not available for the requested platform. You are viewing the content for Default platform.

Sort Namespace References

Purpose

Sorts namespace references in the using section alphabetically or by length.

Availability

Available when the cursor is on a using (Imports) keyword.

Usage

  1. Place the caret on a using (Imports) keyword.

    Note

    The blinking cursor shows the caret's position at which the Code Formatter is available.

    using System;
    using System.Windows.Forms;
    using System.Threading.Tasks;
    using System.Text;
    using System.Collections.Generic;
    using System.Data;
    using System.Linq;
    using System.Diagnostics.Contracts;
    
  2. Use the Ctrl + . or Ctrl + ~ shortcut to invoke the Code Actions Menu.
  3. Select Sort Namespace References from the menu.

After execution, the Code Formatter sorts the namespace references alphabetically.

using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

Configuration

If you prefer sorting references by length, configure it in the Editor | All Languages | Namespace References options page.

CRR_Opt_ReferencesOrganization

Note

This feature is available as a part of Code Cleanup.

See Also