+ 1

What is readonly variable?

c#

3rd Apr 2017, 2:07 AM
Naeem Jutt
Naeem Jutt - avatar
4 Réponses
+ 4
Meaning that you cannot change the variable, its like a constant. You can only access it to read whatever the variable has.
3rd Apr 2017, 2:25 AM
Wen Qin
Wen Qin - avatar
+ 1
means you cant change it. you can only find out what its value is
3rd Apr 2017, 2:14 AM
Edward
+ 1
...is what i just said
3rd Apr 2017, 2:26 AM
Edward
+ 1
U can use readonly key word only on fields(variables). U can assign values to readonly variable only on declaration or inside the same class constructor. for more info: https://msdn.microsoft.com/en-us/library/acdd6hb7.aspx
3rd Apr 2017, 2:44 AM
Eranga
Eranga - avatar