ReSharper 2023.3 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: 04 March 2024