ReSharper | Edit | Duplicate Text
Control+DReSharper_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 shortcut keys. A handy shortcut key reference to make your.NET lifestyle easier and more productive. The most important shortcuts are highlighted in red, like so: Shortcut. General Shortcuts. This posts show how to duplicate the current line of code in Visual Studio 2017, 2015, 2014, 2013, 2012, etc. With no extension.
ReSharper helps you streamline the cloning part — with a single keystroke Control+D the cloned code is inserted right after the original.
- In Visual Studio 2019. In Visual Studio 2017 (v15.6 and after) Ctrl + D. In Visual Studio 2017 (pre v15.6) (edit) This feature is now built-in in VS2017: Ctrl + E, V duplicates a line if nothing is selected, or duplicates selection. You can assign it to a different key combination, or find it in the menu.
- Now, Visual Studio allows us to quickly duplicate a line of code without losing the contents of clipboards. You can just duplicate the line by using Ctrl+E,V This will keep your copy clipboard content intact, and you can past the previously copied information’s. This works well with block of code as well.
- When Visual Studio 2017 was first released, many of my projects were using the manual style and this often caused issues when adding and removing files, as the includes would get out-of-sync or I ended up with duplicate entries.
Quickly duplicate the current line or selection
- 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.
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.
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.
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.

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.
I’ve been using Visual Studio as my primary code editor since 2008, and I put together a list of the top commands I use in VS 2015. I use most of these daily, but the less common ones are nice to fall back on in specific situations. I included the default keyboard bindings from the General profile where appropriate.
Navigation
1. Navigate Backward (Ctrl+-)2. Navigate Forward (Ctrl+Shift+-)These two commands are great for quickly moving the cursor back and forth between its most recent locations.
3. Toggle Bookmark (Ctrl+K,Ctrl+K)4. Next Bookmark (Ctrl+K,Ctrl+N)5. Previous Bookmark (Ctrl+K,Ctrl+P)Bookmarks are useful for saving a location that you need to refer back to often. Alternatively, you can get a second monitor and drag the document out of the tab well to keep it visible.
Visual Studio Mac Free
6. Navigate To (Ctrl+,)Navigate to classes, methods, files, etc. Uses partial string matching.
7. Quick Launch (Ctrl+Q)Search for available commands, options, and tool windows.
IntelliSense
8. List Members (Ctrl+J)9. Parameter Info (Ctrl+Shift+Space)Show IntelliSense info without having to type a character, open paren, etc.
Editing
10. Duplicate Line (Ctrl+C,Ctrl+V)11. Delete Line (Ctrl+X)12. Move Line (Ctrl+X,Ctrl+V)Cut/Copy apply to the current line if there is no active selection.
13. Paste/Cycle Clipboard Ring (Ctrl+Shift+V)Did you get carried away with Ctrl+X and lose what you had on the clipboard? Use Ctrl+Shift+V to paste the previous clipboard contents.
14. Box Editing (Alt+Shift+Arrow)Box editing lets you apply the same edit to multiple lines simultaneously, e.g. add readonly
to a list of field declarations. Also works with the mouse instead of arrow keys.
15. Select Words (Ctrl+Shift+Arrow)Hold down the Ctrl key while selecting text to auto-select whole words instead of using the default character boundary.
16. Comment Selection (Ctrl+K,Ctrl+C)17. Uncomment Selection (Ctrl+K,Ctrl+U)Like most other Visual Studio commands, these will apply to the current line if there is no active selection.
18. Format Document (Ctrl+K,Ctrl+D)Why format the selection when you can format the whole document by using D instead of F?
19. Goto matching brace (Ctrl+])Matches braces, parentheses, html tags, etc.
20. Find and Replace (Ctrl+F/Ctrl+H)You can get a live preview for matches on regular expressions! Use with Shift for find in files.
Visual Studio Code Mac Duplicate Line
21. Find Next (F3/Ctrl+F3)22. Show Whitespace (Ctrl+R,Ctrl+W)Shows spaces and tabs.
Language Commands (C#)

23. Goto Definition (F12)24. Find All References (Shift+F12)Use F8 and Shift+F8 to cycle through results.
25. Quick Actions (Ctrl+.)Show available refactorings or generate code with consume-first development. This one gets more useful with every release.

26. Smart Break Line (Shift+Enter)If the caret is at the ‘|’ in Console.Writeline(Foo(4|))
, Shift+Enter will add the trailing semicolon and put the caret on the next line.
Build & Debugging
27. Build Solution (Ctrl+Shift+B)28. Restore Nuget Packages (n/a)Nuget has become more common recently. For larger solutions, it’s more efficient for me to manually restore when needed instead of performing the nuget checks on every build.
29. Start Debugging (F5)30. Start Without Debugging (Ctrl+F5)31. Stop Debugging (Shift+F5)32. Exception Settings (Ctrl+Alt+E)33. Attach To Process (Ctrl+Alt+P)Useful after Ctrl+F5 or when you need to attach to something that’s already running. If you detach from a process that started without debugging, it will keep executing.
34. Step Over (F10)35. Step Into (F11)36. Step Out (Shift+F11)37. Run To Cursor (Ctrl+F10)38. Step Into Specific (Shift+F10, F)39. Toggle Breakpoint (F9)40. Enable/Disable Breakpoint (Ctrl+F9)The debugger is one of Visual Studio’s best features. With VS 2015 improvements to EnC, you can fix more types of errors without having to stop to rebuild your code.
Testing
41. Run Tests (Ctrl+R,T)42. Debug Tests (Ctrl+R,Ctrl+T)These are context sensitive. Place the caret in a method body to run a single test or in a class to run the tests from that class.
Conclusion
These commands cover most of my daily usage of Visual Studio. Note that you can browse or customize all Visual Studio commands and keybindings from the Options dialog (Alt+T, O, K). If you find yourself repeatedly performing a certain command, assign it to a keyboard shortcut. Unused keybindings are rare, so feel free to repurpose an existing one.
Did I leave out any of your favorite Visual Studio commands? Let me know in the comments.
