+ 6
Learn C# readonly vs const
In the Learn C# chapter 'readonly' is stated that there are basically only 3 differences between const and readonly. But non off them adresses the static property. A const is always automatically static in C#. But I would guess readonly is not static and for every instance one can assign a different value. Am I right or is sth. that is readonly as well static? Anyway, I guess a statment about that in that chapter would be beneficial. /Cheers CL
2 odpowiedzi
+ 5
Yes, you are right. readonly is NOT static by default, you can declare your variable like static readonly var; if you want it to be static too.
0
Great question, good to know :))