ReSharper | Edit | Duplicate Text
Control+D
ReSharper_DuplicateText

One of the ways of creating a code element similar to an existing one (for example, a new method overload or a new auto-implemented property) is cloning the existing element with copy-paste and then editing the clone.

Visual studio c++ example

ReSharper helps you streamline the cloning part — with a single keystroke Control+D the cloned code is inserted right after the original.

Quickly duplicate the current line or selection

Duplicate
  1. If you want to clone a line, set the caret at this line line. To clone an arbitrary piece of code, select it in the editor.

    To select a logical code block, press Control+W one or more times; to select the current declaration, press Control+Shift+OemOpenBrackets.

  2. Press Control+D or choose ReSharper | Edit | Duplicate Text from the main menu. Alternatively, you can press Control+Shift+A, start typing the command name in the popup, and then choose it there.

  3. The duplicated line or multi-line selection is inserted below the original line or selection; the duplicated inline selection is inserted to the right of the original.

  4. If you have duplicated a selection, the selection stays at the clone. If necessary, you can press Ctrl+Shift+Alt and then use arrow keys to move the clone to the desired position.

  1. Vscode duplicate line. Duplicate selection or line, I am trying to find the shortcut for duplicating a line in Visual Studio Code (I am using 1.3.1) I tried the obvious CTRL + D but that doesn't seem to Duplicate selection or line Features. Adds duplicate text functionality to vscode similar to that in Sublime Text or Resharper. Keyboard shortcuts.
  2. Another alternative to the accepted answer that I often use is SHIFT ALT DOWN which duplicates the current line to the line below (likewise, SHIFT ALT UP duplicates to the line above). Once you get the copy of your line you can use ALT UP / ALT DOWN to move it wherever you want.
Visual Studio Code Duplicate Line

Ctrl+C Copy line (empty selection) Alt+ ↑ / ↓ Move line up/down Shift+Alt + ↓ / ↑ Copy line up/down Ctrl+Shift+K Delete line Ctrl+Enter Insert line below Ctrl+Shift+Enter Insert line above Ctrl+Shift+ Jump to matching bracket Ctrl+ / Ctrl+Shift+AltIndent/outdent line Home / End Go to beginning/end of line.

This feature is supported in the following languages and technologies:

The instructions and examples given here address the use of the feature in C#. For details specific to other languages, see corresponding topics in the ReSharper by Language section.

Last modified: 08 March 2021

Visual Studio Code Duplicate Line Windows

If you want to easily duplicate a line of code in Visual Studio Code, you can do it with a simple keyboard shortcut. Just use the Copy Line Down (Ctrl+Alt+UpArrow) or Copy Line Up commands (Ctrl+Alt+DownArrow) — depending on where you want the new line inserted with respect to your cursor.

Visual Studio Select Block

You can view all the shortcuts like this in Visual Studio Code by going to the preference settings found at

Visual Studio Code Duplicate Line Shortcut Mac

If you want to easily duplicate a line of code in Visual Studio Code, you can do it with a simple keyboard shortcut. Just use the Copy Line Down (Ctrl+Alt+UpArrow) or Copy Line Up commands (Ctrl+Alt+DownArrow) — depending on where you want the new line inserted with respect to your cursor.