| Constant(const) | Readonly |
| Constants are immutable values and do not change their value for the life of the program. Constants are known as the compile time. |
ReadOnly is also an immutable value and does not change its value for the life of the program. ReadOnly is known as the runtime. |
| Assigned a value at the time of declaration. Ex
|
Assigned a value either at the run time or inside a constructor (instance initialization). Ex
|
| Constant cannot be static i.e. you cannot declare constant as static. Ex
|
Readonly can be static i.e. you can declare readonly as static. Ex
|
| Constant value can access with the class name. Ex
|
Readonly value can access by instance of the class. Ex
|
Practical Difference Between Constant And Readonly In C#
In this blog, you will learn about the practical difference between constant and readonly in C#.


Subhashkumar YadavPosted Dec 16, 2016, 12:49 AM EST
Nicely explained...............
sushil kumarPosted Dec 8, 2016, 7:24 AM EST
Thank you .....Upendra Pratap Shahi
Upendra Pratap ShahiPosted Dec 8, 2016, 5:33 AM EST
Nice one explaination regarding this...
Jaco ZwartsPosted Dec 6, 2016, 8:30 PM EST
Sushil,Thanks for posting
Mohamed KacemPosted Dec 1, 2016, 7:05 AM EST
It's a good analyse. thanks
Sreekanth ReddyPosted Dec 1, 2016, 12:13 AM EST
It's very clear. Thanks for posting.