Home > DeveloperSection > Interviews > What is readonly keyword in C#?

Posted on    April-28-2011 1:02 AM

 C# C# 
Ratings:
 1 Answer(s)
  1295  View(s)
Rate this:

Amit Singh

Total Post:565

Points:2825
Posted on    April-28-2011 12:00 AM

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;

Don't want to miss updates? Please click the below button!

Follow MindStick