Code snippet is simply XML file
which contains the code that we need to use most frequently while coding. I also
like this feature very much because it save our developing time and increase
productivity. You can create your own code snippet very easily. You can also
add references and replacement parameters to your code.
For that first you need to install
Snippet Designer Extension Tool in visual studio. You can also prepare snippet
file(*.snippet) manually and add/import it using: Tool -> Code Snippets Manager (Ctrl +
K, Ctrl + B). In this post i would like show you how to create and use snippet using Snippet Designer tool.
Steps to install Snippet
Designer:
Goto Tools à Extension Manager.. à It opens Extension Manager window, Now you can install “Snippet Designer”
from Online Gallery tab.
How to Create Snippet:
- Just write your most usable code that you want to insert in snippet, just right click on code block and click Export as Snippet.
- Now you can set Snippet Name, Language and replacement setting.
How to Use Snippet:
- Just press Ctrl + K, Ctrl + X in code behind file, it will open intellisense of all available snippet, so just go through snippet that you want.