Thursday 26 June 2008

.Net Snippet Files

How to create a .Net Snippet.
  1. On the File menu, click New and then click File.

  2. Click XML File and then click Open.

  3. On the File menu, click Save .

  4. In the Save as type box, select All Files (*.*).

  5. In the File name box, enter a file name with the .snippet file name extension.

  6. Click Save.

Code Example....


<codesnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> <codesnippet format="1.0.0">
<header>
<title> My Snippet </title>
</header>
<snippet>
<references>
<reference>
<assembly>System.Windows.Forms.dll</assembly>
</reference>
</references>
<code language="CSharp">
<!--[CDATA[if (jo != null)]]-->
</code>
</snippet>

<br /> My Snippet <br />

To add into your Code Snippets Manager

  1. In the Language list, select the language that you want to add a directory to.

  2. Click Add. This opens the Code Snippets Directory window.

  3. Select the directory that you want to add to the Code Snippets Manager and click OK.The directory will now be used to search for available code snippets.


Useful links....
Create: http://msdn.microsoft.com/en-us/library/ms165394.aspx
Add to manager: http://msdn.microsoft.com/en-us/library/9ybhaktf.aspx













No comments:

Free Hit Counter