---
title: "What is readonly keyword in C#?"  
description: "What is readonly keyword in C#?"  
author: "Amit Singh"  
published: 2011-04-28  
updated: 2020-09-20  
canonical: https://www.mindstick.com/interview/801/what-is-readonly-keyword-in-c-sharp  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# What is readonly keyword in C#?

The **readonly** keyword is a modifier that you can use on fields. When a field declaration includes a **readonly** modifier, assignments to the fields introduced by the declaration can only occur as part of the declaration or in a constructor in the same class.\
\
for example:\

```
public readonly int y = 5;
```

## Answers

### Answer by Amit Singh

The **readonly** keyword is a modifier that you can use on fields. When a field declaration includes a **readonly** modifier, assignments to the fields introduced by the declaration can only occur as part of the declaration or in a constructor in the same class.\
\
for example:\

```
public readonly int y = 5;
```


---

Original Source: https://www.mindstick.com/interview/801/what-is-readonly-keyword-in-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
