Code Snippets feature of Visual Studio allows us to save pieces of code in snippet files, and then easily put them to our projects with the press of a few shortcut keys. This is useful if there is a specific code that you have to use again and again in different projects (for example, the code that handles Facebook login), so instead of writing it each and everytime (or opening another project and then pasting from there) we can just use the code snippet. This is also useful if you are giving presentations about a technical topic since you can prepare the code you’ll use beforehand and don’t bother to write them from scratch during the presentation.
If you have Visual Studio open now, try it yourself: Press Ctrl+K, X; then select a snippet and press enter. The related code will be automatically added to that line.
Under “Documents\Visual Studio 2012\Code Snippets” folder, you’ll see that there are folders for different programming languages, each with a My Code Snippets subfolder where you can put your custom code snippets. If you also wish, you can go to Tools -> Code Snippet Manager in Visual Studio and add other code snippet folders.
➤ Read on if you wish to learn how we can make our own code snippets