Null Coalescing Operator (??) in C#

The .NET Framework provides the Null Coalescing Operator (??) which is a kind of binary operator and enables the developers to quickly check for the null values .

The Null Coalescing Operator (??) in C# can be used with Nullable types as well as reference types .

For example , a??b .If a is not null then assign the value a else take the value b.

Null Coalescing Operator (??) in C#

Below is a sample sourecode demonstrating the usage of Null Coalescing Operator (??) in C#

C#
Null Coalescing Operator (??) in C#
Tags :

Leave Your Comment