Converts an if-else conditional into an expression that uses a ternary operator ("? :" operator in C#, inline IIf function in Visual Basic) and vice versa. These refactorings also support ref ternary expressions. Ternary expressions reduce the amount of code.
The Compress to Ternary Expression refactoring is available when the caret is on a if statement that has a corresponding else block. The if and else blocks should contain one statement. These statements should be similar assignments, returns or method calls with different arguments.
The Expand Ternary Expression is available when the caret is on an expression containing a ternary operator.
Place the caret on a compressible if-else expression.
The blinking cursor shows the caret's position at which the Refactoring is available.