So your colleagues send out an email requesting information on how you manage code snippets and I thought that my colleagues were talking about code snippets. Silly me, just like when someone asks me for a Word Template, I create and send a Word Template with the .DOTX extension. Of course that isn’t what people are asking for, so like templates, my teammates were asking for how to manage snippets of code.
The real deal on code snippets is this:
You can easily make code snippets that can function automatically, like when you type in the word: “if” and then hit tab-tab in Visual Studio it will create an “if” statement:
Which is real handy, but what if you wanted to include a comment to surround that piece of code?
Here is how you do it:
For Code Snippets I usually use the snippet files and show the way to create snippets by copying an existing code snippet, discussing the way to create a “surround” with and where to place the code snippets.
I find that using Code Snippets is an easy way to reuse my comments and code for examples. To show people how to use code snippets (with my audience I have to assume that they have never done any programming, so apologies if this seems somewhat simplistic).
This will work for Visual Basic and ASP.NET(code behind), but not C, CPP nor F#.
Useful post! Thanx!
Thank you for your feedback, always appreciated. Anyone who reads my blog needs an award. :)