ReSharper 2026.1 Help

Code inspection: Math.Sign() method always gives the same result

This inspection reports a call to Math.Sign when value analysis already proves the argument is always negative, always zero, or always positive. In that case, Math.Sign always returns the same result and the call is suspicious or redundant.

Example

class C { int GetSign(int value) { return Math.Sign(-value); } }

If value is known to be always positive at that point, -value is always negative, so Math.Sign(-value) always returns -1.

There is no dedicated quick-fix for this inspection. The usual fix is to replace the call with the constant result or simplify the surrounding logic.

13 April 2026