What’s the difference between const and readonly?

const are compile time constants where as readonly are runtime constants. Once assigned you cannot change the values assigned to variables declared as const or readonly.


Const variable just like their static(shared in VB) counterparts are accessible via Class Names only. They are not accessible via objects.

Readonly variable are instance variable and accessible via objects. Continue reading