共用方式為


Preview Changes window

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

When using various Quick Actions or Refactoring tools in Visual Studio, it is often possible to preview changes that are going to be made to your project prior to accepting them. The Preview Changes window is where this is done. For example, here is the Preview Changes window showing what will be changed during a Rename refactor in a C# project:

Preview Changes

The top half of the window shows the specific lines that will be changed, each with a checkbox. You can check or uncheck each checkbox if you want to selectively apply the refactoring to only specific lines.

The bottom half of the window shows the formatted code from the project that will be changed, with the affected areas highlighted. Selecting the specific line in the top half of the window will highlight the corresponding line in the bottom half. This allows you to quickly skip to the appropriate line and see the surrounding code.

After reviewing the changes, click the Apply button to commit those changes, or click the Cancel button to leave things as they were.

See also