Skip to main content

Smart Dot

  • 2 minutes to read

Smart Dot allows you to write function call chains faster with fewer keystrokes. For example, “myStr.ToUpper().Trim()”.

This feature works in C#, Visual Basic, JavaScript, and TypeScript.

The Smart Dot is also available from code sections in .razor files.

Blazor

How to Use

  1. Place the caret in a parameterless function call.
  2. Press the dot key (.) within empty parentheses.

    CodeRush places the dot and the caret to the right of the closing parentheses. This allows you to call another method in a call chain.

    DotToRight

If you have a complete method call and want to call another method in a call chain on the same line, press the dot key (.) at the end of the line (right after the final semicolon). CodeRush places the dot and the caret to the left of the semicolon. This allows you to create method call chains.

DotToLeft

  1. Place the caret inside parentheses in a method call with parameters.

  2. Double press the dot (.) key quickly.

    CodeRush moves the dot and caret outside the closing parenthesis. This allows you to access a member of the method’s return value.

If you press the dot key (.) more times CodeRush moves the dot and caret out to the right of the next closest closing parenthesis.

Type two dots

  1. Place the caret inside square brackets “[ ]”, for example, in a list element or array element.

  2. Double press the dot key.

    CodeRush moves the dot and caret to the right of the closing bracket.

    Square bracket

How to Enable

To enable Smart Dot, do the following:

  1. Select CodeRush\Options… from the Visual Studio menu to open the options page.

    Open

  2. Enable the corresponding option in the Editor | {Language} | Smart Keys options page.

    Enable

Suppress IntelliSense

CodeRush includes an option that allows you to establish a maximum threshold value (the default value is 500 milliseconds). This option value allows you to determine which feature to use when Smart Dot and IntelliSense are available.

For example, if the time span between dots is less than 500 milliseconds, CodeRush applies Smart Dot and suppresses IntelliSense:

Square bracket