O'Reilly logo

Microsoft Visual Studio 2015 Unleashed, Third Edition by Mike Snell, Lars Powers

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

Inline Temporary Variable

The Inline temporary variable refactor allows you to remove temporary variables from your code and replace them with actual code expressions assigned to the temporary variable. Think of this as the opposite of Introduce Local. For example, Figure 9.13 shows how you can turn the discount variable back into inline code.

Image

FIGURE 9.13 Use the Inline temporary variable to turn temporary variables into inline code.

The result of this Refactor operation is the removal of the temporary variable. The use of the temporary variable is then replaced by inline code, as the following shows.

//apply discount ...

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