ReSharper
 
Get ReSharper
Get your hands on the new features ahead of the release by joining the Early Access Program for ReSharper 2025.1! Learn more

Code inspection: Simplify conditional ternary expression

Last modified: 11 February 2024

If your ternary expression (an expression of the form a ? b : c) contains a boolean constant as either b or c, it can be converted to a much simpler expression. For example, this

can be simplified to this: