Creating your own snippets

Visual Studio snippets are a great way to quickly write repetitive chunks of code that follow the same basic structure—potentially, saving you from a lot of time and typing. Snippets have been extended to work on more than just standard code files, and should be considered whenever you find yourself writing similar code over and over. Using snippets can save time and reduce the possibility of bugs—simply write the code correctly once, and then reuse.

For example, you may want to generate a class signature that inherits from a specific base class you use in your application, or you may have a certain attribute that needs to be placed above method calls to enable logging, or you may have specific IDs you want to use in ...

Get Visual Studio 2015 Cookbook - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.