C# language feature:
applies to
benefit
how to use
.
with ?.
Use this construct with the null coalescing operator ??
to assign default values when one of the properties are null.example:
class Null_Propagator_Example
{
void Use_of_Null_Propagor(string somestring)
{
int length = somestring?.Length ?? -1;
System.Console.WriteLine($"somestring has {length} characters"); // lenght is -1 if somestring is null.
}
}