Converts an if/else conditional into an expression that uses a ternary operator ("? :" operator in C# and C++, IIf operator in Visual Basic).
This refactoring can help you avoid code duplication. It can compress two similar code lines within if and else blocks into a single-line expression, eliminating the need to make future changes in two places.
if (a) b = 10; else b = 20;
If a Then b = 10 Else b = 20 End If
b = a ? 10 : 20;
b = If(a, 10, 20)