Code inspection: Redundant discard designation
This inspection reports a discard designation in a type or recursive pattern when the pattern does not need any designation at all. The _ does not capture anything and adds no value to the match.
Example
class C
{
void M(object value)
{
if (value is string _)
{
}
}
}
class C
{
void M(object value)
{
if (value is string)
{
}
}
}
Quick-fix
Remove the redundant discard designation from the pattern.
13 April 2026