O'Reilly logo

Professional Visual Studio® 2010 by Chris Anderson, Michael Minutillo, David Gardner, Nick Randolph

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Code Snippets and Refactoring

WHAT'S IN THIS CHAPTER?

  • Using code snippets

  • Creating your own code snippets

  • Refactoring code

One of the advantages of using an Integrated Development Environment (IDE) over a plain text editor is that it's designed to help you be more productive and efficient by enabling you to write code faster. Two of Visual Studio 2010's most powerful features that help increase your productivity are its support for code snippets and the refactoring tools that it provides.

Code snippets are small chunks of code that can be inserted into an application's code base and then customized to meet the application's specific requirements. They do not generate full-blown applications or whole files, unlike project and item templates. Instead, code snippets are used to insert frequently used code structures or obscure program code blocks that are not easy to remember. In the first part of this chapter you see how using code snippets can improve your coding efficiency enormously.

This chapter also focuses on Visual Studio 2010's refactoring tools — refactoring being the process of reworking code to improve it without changing its functionality. This might entail simplifying a method, extracting a commonly used code pattern, or even optimizing a section of code to make it more efficient.

Although refactoring tools are implemented for C# in Visual Studio, unfortunately they haven't been implemented for VB. In order to fill this hole in functionality in previous versions of ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required