Visual Studio 2010 code reuse tips

It’s tip day. Not like this will be a regular thing, but I found these two items handy.

First is creating snippets for VS 2010. You know, of course, that you can right click inside the editor window of Visual Studio and select Insert Snippet to easily insert all kinds of goodness into your code.

You can also create your own snippets if you find yourself writing the same type of code over and over again. I found a concise tutorial on on just how to do this.

In a similar vein of improving development, you can also drag and drop text from the editor window onto the Toolbox. Once there, you can easily drag that code from the Toolbox and into your code.

First, pin the Toolbox so it’s open, then expand the General tab. Then, just highlight the section of code you previously added and drag it onto the General section.

And you can also rename those sections of code dragged onto the Toolbox by right clicking on the code block and selecting Rename. I would suggest doing that, because otherwise it looks ugly and semi-indecipherable.

I found has a visual version of what I just wrote, if you’d like some screenshots. It’s very easy, and especially useful if you are going to give a presentation or lunch and learn.

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: