---
title: "Why to use “Nullable Coalescing Operator” (??) in C#?"  
description: "Why to use “Nullable Coalescing Operator” (??) in C#?"  
author: "Anonymous User"  
published: 2018-04-18  
updated: 2020-09-18  
canonical: https://www.mindstick.com/interview/23385/why-to-use-nullable-coalescing-operator-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Why to use “Nullable Coalescing Operator” (??) in C#?

Nullable Coalescing Operator can be used with reference types and nullable value types. So if the first operand of the expression is null then the value of second operand is assigned to the variable.

## For example,

```
double? myFirstno = null;
double mySecno;
mySecno = myFirstno ?? 10.11;
```

## Answers

### Answer by Anonymous User

Nullable Coalescing Operator can be used with reference types and nullable value types. So if the first operand of the expression is null then the value of second operand is assigned to the variable.

## For example,

```
double? myFirstno = null;
double mySecno;
mySecno = myFirstno ?? 10.11;
```


---

Original Source: https://www.mindstick.com/interview/23385/why-to-use-nullable-coalescing-operator-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
