Null coalescing operator with method calls

suggest change

The null coalescing operator makes it easy to ensure that a method that may return null will fall back to a default value.

Without the null coalescing operator:

string name = GetName();
if (name == null)
    name = "Unknown!";

With the null coalescing operator:

string name = GetName() ?? "Unknown!";

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents