Question:

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

Answer:

  • “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.

Keywords:

© 2017 QuizBucket.org