---
title: "How to use “Nullable Coalescing Operator” (??) in C#?"  
description: "How to use “Nullable Coalescing Operator” (??) in C#?"  
author: "Sushant Mishra"  
published: 2017-07-17  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/23280/how-to-use-nullable-coalescing-operator-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# How 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,

```
Int?
myFirstno = null;Int no.;no= myFirstno
?? 1;
```

## Answers

### Answer by Sushant Mishra

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,

```
Int?
myFirstno = null;Int no.;no= myFirstno
?? 1;
```


---

Original Source: https://www.mindstick.com/interview/23280/how-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.
