Adding code clips (aka snippets) to Visual Studio.Net
Adding code clips (aka snippets) to Visual Studio.Net
Ever have a piece of code you hate typing or keep forgetting the proper syntax (like how to construct a foreach statement)? Back when I use to code in EditPlus (a fancy text editor with code highlight support) it had a toolbar on the left where I could add pieces of code and drag'n'drop them into my current project. This is great for things like a general HTML page (with head, title, meta, etc tags) or blocks of code I couldn't always remember how to type properly.
Well I decided I wanted the same thing for Visual Studio and I started to search the net for an add-on when a friend pointed out Visual Studio.NET has it built in!!!
Simply go to your toolbox, right click and pick "Add Tab" and type in the name of your tab (I called it "Code Clips") then click on the tab. Now go to your code, highlight what you want, click the code and drag it into your tab content and there you go. You should right click this entry and choose "Rename" to give it a proper name as it will have the code as the name by default.
The first thing I added to my clips is the general XML comment syntax complete with params and returns so I have a quick way to comment my code.
If you can't find your Code Clips tab later on, then simply right click the Toolbox content and pick "Show all Tabs".