How many times have you needed to create a new property with
its private field in your objects or pages? You had to copy and paste the
private field and its property and change the private field name, private field
data type, property name, and the property data type. The Code Snippet feature is
the solution for this repetitive work. You can now insert a generic property
and all you need to do is change the property and private field data types and
names without the need to write the whole property and private field codes
again.
So now that you know what a code snippet does, let us
discover what a code snippet is. A code snippet is nothing but an XML-formatted
file which has .snippet as a file extension and is registered in Visual
Studio 2005 using the Snippet Code Editor. A code snippet supports replaceable
values and referencing assemblies (Visual Basic.NET only). I will be showing
the contents of a snippet file and how to create a new one later on in this
article.
Visual Studio 2005 comes with a set of predefined code
snippets. If you want to add your own code snippet, then you must use the
Visual Studio 2005 Code Snippet Manager.