Code inspection: Try cast and check for null can be replaced with a type check
This inspection reports as casts that are only used to check whether a value has a given type. In that situation, is expresses the intent more directly and avoids an unnecessary cast.
Example
if (obj as string != null)
{
Use();
}
if (obj is string)
{
Use();
}
Quick-fix
Replace the as cast and null check with an is type check.
01 April 2026