How to store reusable code in Visual Studio 2010?

Is there any way I could save my block of code in Visual Studio 2010 and reuse it in my future web applications without having to "Add existing files"? Is there a feature in VS2010 that lets you globally store these blocks of code?



Oded pretty much covered it but I'll just reiterate here. There are three main ways you can do this depending on how much code you want to store.

For a little code just copy the code to your Toolbox:

For a little code to very large blocks of code (with some intelligence for putting in values) you can use code snippets:

And for lots of custom files, resources, etc... that essentially make up a new project you should use project templates:

Visual Studio has a feature called code snippets, which will allow you to do exactly that.

If you want a more advanced use - for whole files, sets of files and even whole projects, use templates.

Need Your Help

How can I call a DB2 stored procedure with OUT parameters from SQuirreL SQL?

stored-procedures db2 squirrel-sql

I really like SQuirreL SQL as a SQL query tool, but I've never been able to get it to call stored procedures in our AS/400 DB2 database. I always get the error "The number of parameter values set or

Developing SQLDeveloper extensions using Python

python oracle oracle-sqldeveloper

I searched a lot about developing extensions for SQLDeveloper and all the information I found regarding this subject involved using Java.