Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Collapse]CodeRush
  System Requirements
 [Expand]Features by Language
 [Expand]Getting Started
 [Expand]Coding Assistance
 [Expand]Navigation and Search Tools
 [Expand]Static Code Analysis
  Visualization Tools
 [Expand]Code Style Assistance
  Building Assistance
  Debugging Assistance
 [Collapse]Refactoring Assistance
   Boolean To Enum
   Combine/Split Conditional(s)
   Compress to/Expand Null Coalescing Operation
   Compress to/Expand Ternary Expression
   Compress/Expand Assignment
   Conditional to Switch/Switch to Conditional
   Convert Nested Element to Attribute/Attribute to Nested Element
   Convert to Auto-implemented Property
   Convert to Constant
   Convert to Math.Pow call
   Convert to Property with Backing Field
   Convert to String Interpolation
   Convert to System Type/Built-in Type
   Convert to Tuple
   Convert to/Decompose Initializer
   Decompose Parameter
   Extract Interface
   Extract String to Resource
   Flatten Conditional
   ForEach to For/For to ForEach
   ForEach To Linq
   Inline Method
   Inline Method (and delete)
   Inline Temp
   Introduce Using Statement
   Make Implicit/Explicit
   Make Read Only
   Move Declaration Near Reference
   Move Initialization To Declaration
   Move Type to File
   Move Type to Namespace
   Optimize Namespace References
   Remove Redundant Assignment
   Remove Redundant Constructor
   Remove Redundant Delegate Creation
   Remove Redundant Destructor
   Remove Type Qualifier
   Remove Unused Member
   Remove Unused Parameter
   Rename
   Rename File to Match Type
   Rename Namespace To Match Folder Structure
   Rename Type To Match File
   Reorder Parameters
   Reverse Boolean
   Reverse Conditional
   Simplify Expression
   Split Initialization From Declaration
   Split String
   Use Environment.NewLine
   Use Expression Body
   Use nameof
   Use string.Compare
   Use string.Format
   Use string.IsNullOrEmpty
   Use StringBuilder
   Widen Scope
   Widen Scope (promote to field)
 [Expand]Unit Testing Assistance
 [Expand]Decompiling Tools
 [Expand]Configuration Options
 [Expand]Extensibility
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Refactoring Assistance

Refactorings are CodeRush features that enable you to automatically perform stereotype changes in your code.

CodeRush adds refactorings, code providers, and code formatters to Visual Studio's light bulb menu (Code Actions Menu). To invoke the Code Actions Menu, put the caret on the part of the code you need to change, press Ctrl + . or Ctrl + ~, and choose the required action from the invoked menu. When the cursor is on a Code Action Menu item, you can see a preview of the changes that will be made to your code.

Entries in the Code Actions Menu fall into the following categories:

  1. Code Formatters — do not change code behavior, but can improve code readability and layout to match a certain style. For instance, Sort Namespace References.
  2. Refactorings — do not change code behavior, but can simplify your code, improve readability, make code more flexible (for future changes), or bring the code to meet certain standards. For instance, Inline Method.
  3. Code Providerscan change code behavior or declare undeclared types and members. Use them to supplement your code with blocks which you might want to type manually. For instance, Create Event Trigger.

This section describes each Refactoring in detail. The description includes the purpose of the Refactoring, its availability and a usage example.

How would you rate this topic?​​​​​​​