WHAT IS READONLY KEYWORD IN C#?

Amit Singh

Total Post:565

Points:2825
Posted by  Amit Singh
C# 
C#
 1489  View(s)
Ratings:
Rate this:
  1. Amit Singh

    Post:565

    Points:2825
    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;

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!