ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Creating Your Own Code Snippets with Whidbey
Subject:   In defence of Snippets
Date:   2004-03-11 04:42:17
From:   sreejath
Hi,
I'm sure most of us would agree that Copy-Paste coding has many pitfalls.

However, being professional developers, I'm sure we would, all of us, have come across source code that we could use in a specific situation.

I dont know about the rest of us, but speaking for myself, I usually store it as a file in a folder within a folder structure.

However, to use it, I still need to find the file, open it, copy the code into the code window and make the necessary changes.
This is in addition to setting the reference and imports. And if you are like me, you would forget to do the last two mentioned. :-)

Having the snippet accessible from the code window context menu is a significant productivity enhancer. And to have it set the references, add the Imports and put highlighted placeholders is the icing on the cake.
Of course, I could create an assembly if the snippet encapsulates significant functionality. However, in my opinion, the raison d' etre of a snippet is to minimise the effort involved in implementing the routine bits of functionality.
And as far as this goal is concerned, I think the snippets feature as implemented in the VS .NET Whidbey is certainly up to the mark.

But I do have one grouse though.

I work predominantly in C# and would like to see this work from C# ASAP.

Are any MSFT people listening? :-)