Use conditional access operator or pattern matching to safely access nullable valueCS-R1136
While it is common to explicitly check an object's nullability before accessing its value, you can further simplify this expression by
either using the conditional access operator ?
or pattern matching instead. These proposed solutions are succinct and reduce your
keystrokes.
Bad Practice
if (analyzer != null && analyzer.name == "csharp")
{
// ...
}
Recommended
// Using the conditional access operator
if (analyzer?.name == "csharp")
{
// ...
}
// Using pattern matching
if (analyzer is {name: "csharp"})
{
// ...
}