Tuesday, 29 March 2016

difference between “constant” and “readonly” variables in C#?

  • “Const” keyword is used for making an entity constant. We cannot modify the value later in the code. Value assigning is mandatory to constant variables.
  • “readonly” variable value can be changed during runtime and value to readonly variables can be assigned in the constructor or at the time of declaration.

No comments:

Post a Comment