ReSharper 2016.1 Help

Code Inspection: Simplify conditional ternary expression

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

public bool CanVote { get { return myAge >= 16 ? isCitizen : false; } }

can be simplified to this:

public bool CanVote { get { return myAge >= 16 && isCitizen; } }

See Also

Last modified: 19 August 2016