What is the difference between 'const' and 'readonly' in C#?

  1. No difference, they are identical
  2. readonly can only be used with strings
  3. const is compile-time constant, readonly is runtime constant
  4. const is runtime constant, readonly is compile-time

Explanation

const values are compile-time constants and must be assigned at declaration, while readonly values are runtime constants that can be assigned in constructors or at declaration.