Hi friends,
What is the difference between const and readonly keyword ?
Thanks
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Dipal ChoksiPosted Oct 31, 2011, 1:27 PM
VulpesPosted Oct 31, 2011, 1:04 PM
* const denotes a compile-time constant which the compiler can replace with its actual value .
* readonly denotes a runtime constant which cannot be evaluated until runtime. It must be set either within a constructor or where it is defined.
Javeed M ShaikhPosted Oct 31, 2011, 12:55 PM
http://www.c-sharpcorner.com/UploadFile/sayginteh/ConstAndReadOnly11112005005151AM/ConstAndReadOnly.aspx