Delete a line in Visual Studio without copying it?
Solution 1:
By default, if you are using the C# default profile, you can delete a line using Ctrl + Shift + L.
You can customize this using Tools->Customize. Select "Keyboard". Look for the command Edit.LineDelete to assign it to whichever keyboard shortcut you like.
Solution 2:
If you got here looking for an answer for Visual Studio Code the default shortcut is:
ctrl + shift + K for Windows
⌘ + shift + K for MacOS
However, you can change on File > Preferences > Keyboard shortcuts
{
"key": "ctrl+shift+delete",
"command": "editor.action.deleteLines",
"when": "editorTextFocus && !editorReadonly"
}
For Visual Studio answer see @heavyd's answer
Solution 3:
Ctrl + Shift + K
will work fine for both Windows and Linux.
Solution 4:
Go to tools -> options. Tab Environment -> subtab Keyboard.
Select Edit.LineDelete. Assign a shortcut. Thats it. I use Alt + D.