JetBrains Rider 2022.2 Help

Code Inspection: Ternary expression has identical true and false branches

This one’s fairly obvious. The following expression:

return condition ? result : result;
Return If(condition, result, result)

is identical to the following

return result;
Return result

since the condition does not affect what is being returned.

Last modified: 08 March 2021