What is the purpose of ?? operator in C#?
What is the purpose of ?? operator in C#?
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.
For example, let’s consider the following code snippet.
[csharp] int? x = null;
View On WordPress










