Posts Tagged ‘Code Snippet’

The Snippy tool for my own snippets

April 14, 2010 Leave a comment


What to do?

Let us to make a snippet called “propb” which generates next final code.


Download the Snippy and Run it.

You can make your own code snippets using the Snippy which provides visual configurations of your own code snippets.

Download the source at and build the solution. This is the Snippy application screen.


Fill the Base Section.

Fill the Title, Shortcut, Author and Description. Shortcut is important key to use later this snippet.


Set the Literals and objects section.

In our “propb” snippet, we would add 3 objects of type,property and pmember. This is the list after adding them.


Click the Add button and fill the forms. This is a sample for a object addition.


Write the snippet code in to the code area.

Change ‘Language’ to csharp and type the code. You should mark a previous Object like ‘pmember’  with ‘$…$’ string. Also you can mark ending focus section writing ‘$end$ string.


Yes!. We’ve finished editing in the Snippy tool.

Write the snippet code in to the code area.

Save to the ‘My Code Snippets’ directory path.


Save the snippet with ‘propb’ file name to the My Code Snippets under the Windows my documents.


It is easy to check it in your Visual Studio Snippets Manager. Go to the Tools > Code Snippets Manager.


Use the snippet we made.



Visual Studio Code Snippet

April 14, 2010 1 comment


What is the Code Snippet?

Code snippets provide faster code generation with developer’s input options. Visual Studio supports various code snippets for C#,VB,XML and so on.

Checking Code Snippets in Visual Studio

You can check installed snippets in Visual Studio easily. Open Visual Studio > Tools > Code Snippets Manager.

001.location of code snippets manager

Navigate to the installed snippets in the Snippets Manager. You can see the information and locations of many snippets.

002.code snippets manager

These are installed snippets on my Visual Studio 2008.

003.installed snippets

Selecting C# snippets in the Visual Studio.

OK. Let us start to use a snippet for practice. We will use the “prob” snippet to generate private property with getter and setter. In the C# editor, type the start characters of “prop” and you can see the list of similar snippets. After selecting, press the TAB key twice.

004.typing snippet shortcut

The “int” and “MyProperty” strings with background color are the objects waiting your customizations. You can navigate objects in this snippet using TAB key.


Filling C# snippets.

Write some start words you want. If there are matched object type, you can see candidate list. Select and press TAB to fill.

006.value input

If you finish filling objects in the snippet, press ENTER key to exit.