Skip to content

Ignored method result (CA1806)

Key dotnet.codequality.ignored-method-result · Severity warning · Category codequality

Microsoft analyzer CA1806. Flags a call whose only effect is its return value - a new string from Trim or Replace, a parsed number, a created object - being discarded. The call changes nothing.

name.Trim();
int.TryParse(input, out _);
name = name.Trim();
if (!int.TryParse(input, out var count)) return BadRequest();