DEV Community

nineismine
nineismine

Posted on

14 4

12 tips, tricks, and Visual Studio 2019 shortcuts to increase efficiency - Part 1

Visual Studio 2019 shortcuts

Quickly add public properties

You can add properties to your classes the quick way by typing prop and then tab tab

In this case were going to make a property and name it hitPoints

example of creating property

 

 

Quickly populate a full property with public and private members

you can do the exact same thing except type propfull to get the full property

public int MyProperty
{
    get { return myVar; }
    set { myVar = value; }
}

Quickly add a new class to your project

CTRL + Shift + A

Example of how to create a class from the keyboard

Go to the definition of any object

This is a quick way to navigate to the definition that is under your cursor. For bonus points try ALT + F12 which brings up the "peek" dialog for that item. From within that dialog box you can also CTRL click other items to go straight to them.

F12

example of navigation to property

Move lines up and down in the editor

You can move lines just by pressing

Alt + up/down arrows. 

You can also Shift-Select a bunch of lines and then Alt-Arrow them around as a group.

Example of moving text in the Visual Studio editor

 

 

 

 

 

 

 

Quickly Launch a new project or search your solution , add a class and lots of other stuff.

Most of the things that you use in the menus, you know, when you open the menu Tools>Options and then just start until you find whatever you are looking for..

CTRL + Q

Quickly populate Console.WriteLine()

Type

CW TAB TAB 

Example of quick console writeline

Quickly populate an IF statement, for loop , foreach loop , do , while, enums and others

This works for many of the common things we do in Visual Studio

Type any of the above keywords and  TAB TAB

There are probably some others that I missed. (let me know in the comments!)

example of populating loops with tab tab

 

 

Open Quick actions and Refactoring (from here we can do a whole host of things)

CTRL + .

(control key + the period)

example of quick actions and refactoring

Quickly Navigate to... well anything

Another useful shortcut to remember is the NavigateTo command  , this command lets you search for class names, files, members, types or even method names. This is super useful when working in a large project with many methods and classes

Press CTRL +, and start typing.

Once you learn this command you will not really even need the Solution Explorer.  As long as you already know the name of the item you want to see.

(Control + comma)

Example of quick search

Quickly search your solution explorer

While I don't use this one very much because of the last tip. You CAN use this tip to search explicitly in the solution explorer.

CTRL + ;

 

Quickly run an automated test

if you are using automated testing you can run a test from the keyboard by pressing

CTRL + R , T

 

I really hope these Visual Studio 2019 shortcuts help you as much as they have me. I only recently learned some of these and I sure wish I'd have know them earlier.

If you like this or other posts by me check out the rest of my blog site TheDevelopingDeveloper.net and subscribe for updates!

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (3)

Collapse
 
bellnorm profile image
Norm •

Great list! Thanks.

Collapse
 
nineismine profile image
nineismine •

There are some pretty great time savers in VS ! :)

Collapse
 
nineismine profile image
nineismine •

Whipped this up last night and this morning. Some of these I just learned last night and holy crow was I missing out!

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more