+ 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?

10th Mar 2018, 2:36 AM
Thiru Arasu
Thiru Arasu - avatar
2 ответов
+ 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/
10th Mar 2018, 10:16 PM
sneeze
sneeze - avatar
+ 1
Readonly modifier means you can get value, but you cannot set value.
10th Mar 2018, 5:40 AM
Zayniddinova Vasilya Bakievna
Zayniddinova Vasilya Bakievna - avatar