+ 2
What is meant by readonly modifier in C#?
I had learnt c# in SoloLearn. but this concept was not clearly explained here.could anyone explain it me clearly?
2 Answers
+ 2
What do you exactly mean by readonly ?
A readonly field is defined using the readonly modifier. A read-only property is defined by including a get accessor for the property, but not a set accessor.
A readonly field can have only a single value, set either at the time that the field is declared, or in a constructor. A read-only property returns a value that may be different each time the property is read.
https://csharp.2000things.com/tag/read-only-property/
+ 1
Readonly modifier means you can get value, but you cannot set value.