Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio keyboard short-cut to complete default accessors {get; set;}

I am looking for a keyboard short-cut to complete creating the default accessors for a property in a C# class.

Something like...
I start typing:

public int Id  

Then I press one or more keys, and I endup with:

public int Id { get; set; } 
like image 852
Zamboni Avatar asked May 29 '10 20:05

Zamboni


People also ask

How do I set Keyboard Shortcuts to default in VS Code?

All keyboard shortcuts in VS Code can be customized via the keybindings. json file. To configure keyboard shortcuts through the JSON file, open Keyboard Shortcuts editor and select the Open Keyboard Shortcuts (JSON) button on the right of the editor title bar. This will open your keybindings.

What is Ctrl K in Visual Studio?

Edit.SelectionCancel. Surround with. Ctrl+K, Ctrl+S. (available only in Visual Studio 2019 and earlier)

What is Ctrl Shift F in Visual Studio?

Ctrl-Shift-F is used to find all the ocuurance of a string with in entire solution and display find result window as shown below. Ctrl-F is used to find a string in the current document, project and all open documents one by one.


2 Answers

The shortcut is the trigger "prop":

proptabtabinttabIdtab

and you end up with:

public int Id { get; set; } 
like image 104
x0n Avatar answered Oct 09 '22 17:10

x0n


Try with propfull , then TAB Twice and you'll get:

private int myVar;      public int MyProperty     {         get { return myVar;}         set { myVar = value;}     } 
like image 41
Nenad Bulatović Avatar answered Oct 09 '22 18:10

Nenad Bulatović