Kasper Hansen
Kasper Hansen

Reputation: 6557

Shortcut for autocompleting properties in visual studio?

I was watching a video about C# and the guy used a shortcut to implement a property.

public decimal Price { get; set; }

He wouldn't write the whole line, but instead let the visual studio editor fill in the get and set. Does anyone know the shortcut for completing the last part of the line above? Or even better, like a pdf quick-reference overview?

Upvotes: 14

Views: 18782

Answers (1)

Jackson Pope
Jackson Pope

Reputation: 14640

In Visual Studio 2010 you can type 'prop' then press tab twice. It's probably the same in earlier versions.

Edit: You'll then have to change the type (defaults to int) and the name (defaults to MyProperty).

Edit2: I've just found this great tool that allows you to edit these code snippets to override their default behaviour, or create new ones: http://snippeteditor.codeplex.com/

Upvotes: 29

Related Questions