Refactoring in Visual Studio

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, use the version selector at the top left. We recommend upgrading to Visual Studio 2019. Download it here

Refactoring is the process of modifying code in order to make it easier to maintain, understand, and extend, but without changing its behavior. Some common refactorings include:

  1. splitting long functions into smaller ones

  2. renaming variables, types, functions or parameters

  3. reordering parameters

  4. removing or reordering using directives

    Because the logic of refactoring is closely tied to language syntax, each language service in Visual Studio provides its own refactoring capabilities. For more information, see the following pages:

Refactoring in C#

Refactoring (C#)

Refactoring in Visual Basic

Refactoring and Rename Dialog Box (Visual Basic)

Refactoring in C++

Writing and refactoring code (C++)

Refactoring in F#

Refactoring support for F# is provided in Visual F# Power Tools, a third-party Visual Studio extension.

See Also

Visual Studio IDE Writing Code in the Code and Text Editor