- Home Page of ProjectGuideline.com ›
- Forums ›
- General Discussion Forum ›
- Programming Competition For Students ›
- Differ b/w “readonly” and “const” in C#
pandikumar
Participant
what is the differents between the “const” and “readonly” in C#. Both of them were used for constant value but why these two?
lalit
Participant
Constant
1) This must be initilize at the time of declaration.
2) This is same for all of objects class.
3) It initilize at the time of compilation.
Readonly
1)This can be initilize at the time of object creation.
2) This may be different for different objects of class.
3) It Initilize at Runtime.