Shortcut to create properties in Visual Studio?
I have seen some people creating properties in C# really fast, but how did they do it?
What shortcuts are available in Visual Studio (currently using Visual Studio 2010) to create properties?
I am using C#.
For example,
public string myString {get;set;}
You could type "prop" and then press tab twice. That will generate the following.
public TYPE Type { get; set; }
Then you change "TYPE" and "Type":
public string myString {get; set;}
You can also get the full property typing "propfull" and then tab twice. That would generate the field and the full property.
private int myVar;
public int MyProperty
{
get { return myVar;}
set { myVar = value;}
}
In addition to Amra's answer, you can find other snippets by typing
Ctrl + K, Ctrl + X
Which is mapped to Edit.InsertSnippet in my Visual Studio and shows you the full list of snippets available.
Place cursor inside your field private int _i;
and then Edit menu or RMB - Refactor - Encapsulate Field... (CtrlR, CtrlE) to create the standard property accessors.