Difference between const and readonly in C#.NET
What is the difference between const and readonly in C#.NET?Const | Readonly | It can be initialized const variables while declaration. | It can be initialized only while declaration or in the constructor. | You cannot reassign a const variable. | Once you initialize a field, you cannot reassign it. | Static modifier is not allowed. | Static modifier is allowed for readonly fields. | It cannot be modified. It needs to be instantiated only at the compile time. | It can be modified by the class. |
|