Code Providers

  • 2 min to read

CodeRush ships with over 40 Code Providers that allow you to make routine changes in code and write code faster.

The topics in this section describe each Code Provider in detail. The description includes the purpose of the Code Provider, its availability and the "how to use" example.

How to Use

  1. Invoke the Code Actions Menu. Place the caret in the part of the code you want to change, and press Ctrl + . or Ctrl + ~.


    CodeRush adds code providers, refactorings, and code formatters to Visual Studio's light bulb menu (Code Actions Menu).

  2. Choose the action from the invoked menu. For example, Declare Field with Initializer.

    You can see a preview of the changes CodeRush can apply to your code. Code_Generation_Main

  3. Press Enter to perform the action.

    The red target picker appears in Declaration Providers. This picker allows you to choose the place where the generated code can be inserted.


    You can configure which Declaration Provider should invoke the target picker in the Editor | All Languages | Code Actions | Target Picker options page.


  4. Use the Up Arrow and Down Arrow keys to move the target picker.

  5. Press Enter to generate code in the selected position. For example, the Declare Field with Initializer code provider adds the initialized field declaration to the current class and assigns the parameter value to it.

int iD;
bool DeleteRecord(int ID) {
    iD = ID;
    // ...
    return true;