Groups > Asp .Net > Visual Studio 2005 > Re: How to add our own code snippet while writting code in Visual studio IDE




How to add our own code snippet while writting code in
Visual studio IDE

How to add our own code snippet while writting code in Visual studio IDE
Mon, 31 Mar 2008 09:09:22 +000
How to add our own code snippet while writting code in Visual studio IDE?

for example i want to insert  following snippet for any event , what needs to be
done?

bool workSuccessful = false;

try

{

   // do some work

   workSuccessful = true;

}

finally

{

  if(!workSuccessfull)

  {

    // cleanup code here.

  }

}
Post Reply
Re: How to add our own code snippet while writting code in Visual studio IDE
Wed, 2 Apr 2008 10:09:25 +0000
Hi,

To custom the code snippet, we need to create the code snippet XML file which
has the specific structure, such as header section, snippet section, etc. In
this XML file, we can declare the variables and write code block. If we do so,
we can use the Code Snippets Manager to add this code snippet.

For example, you can refer to
http://blog.paranoidferret.com/index.php/2007/11/07/csharp-tutorial-visual-studi
o-code-snippets/

 

I hope this helps.
Post Reply
about | contact