What is the difference between 'const' and 'readonly' in C#?
- No difference, they are identical
- readonly can only be used with strings
- const is compile-time constant, readonly is runtime constant
- 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.