The Introduce local refactor allows you to convert an expression of code to a local variable within your method (or similar). This can make your code easier to read. It is also useful if you plan to reuse the result of the expression multiple times. Figure 9.12 shows converting the discount amount (total * .10) to a local variable.
The result of the Refactor operation is a variable to represent the discount. You can now change the code to make it more readable, as follows.
//apply discount rule
if (total > discountThreshold)
{
var discount = total * discountPercent;
total = total - discount;
}