Visual Studio Refactoring Basics

The Visual Studio refactoring tools work to ensure that you see the promises of refactoring: increased reuse of your code, fewer rewrites, reduced duplication, and better readability. These tools work to instill confidence in the edits they make to your code. They do so by using a common refactoring engine based on the new .NET compiler platform (“Roslyn”) rather than string matching and search-and-replace. The engine and compiler work together to cover the entire code base (and its references) to find all possible changes that need to be made as part of a given Refactor operation. The engine even searches out code comments and tries to update them to reflect new type names. In addition, you can preview changes to your code before they happen. This adds further to your comfort level with the modifications these tools are making to your code.

Table 9.1 presents a high-level overview of the many Refactoring operations that are possible with the code editor. We cover each of them in detail in the coming sections. First, however, we cover some of the common elements of the refactoring process. These elements include both invoking a refactoring tool inside Visual Studio and previewing the refactoring changes as they happen.

Image

TABLE 9.1 Refactoring Operations Inside the Visual Studio Code Editor

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset