What is the purpose of ?? operator in C#?

added by DotNetKicks
10/25/2017 2:04:53 PM

2 Kicks, 334 Views

The ?? operator is called the null-coalescing operator. It returns the left-hand operand if the operand is not null; otherwise, it returns the right-hand operand. You might already know that C# 2.0 provides us Nullable Types which can be used to store null values for value type variables such as int, float, decimal etc.