TypeName | ExistenceOperatorAnalyzer |
Check Id | CC0018 |
Category | Style |
Severity | Info |
The null-propagating operator allow for terse code to handle potentially null variables.
namespace ConsoleApplication1
{
class TypeName
{
public string Foo()
{
A a = null;
if (a != null)
return a.Name;
else
return null;
}
}
}
A code fix will be presented to you that will transform the code:
namespace ConsoleApplication1
{
class TypeName
{
public string Foo()
{
A a = null;
return a?.Name;
}
}
}
None
TBD