What's difference between constants and static readonly?
Constants : Constant value is initialized at compile time. Const int a=10;static Readonly : Static Readonly Initialize in static constructor only.
readonly: This is the Runtime constant. We can initialize the values once through constructor(while running).
A const must be initialized at the time of its creation. A readonly field can be assigned to once in the class constructor allowing you to pass in the value at run-time. Declaring fields as const protects both you and other programmers from accidentally changing the value of the field. Also note that with const fields, the compiler performs some optimization by not declaring any stack space for the field. The readonly keyword is similar to const, with two exceptions. First, the storage of a readonly field is the same as a regular read-write field, and thus there is no performance benefit. Secondly, readonly fields can be initialized in the constructor of the containing class.
Constants :- it's value set at compile time and support value types Static readonly:it's value set at run time and are able to hold refrence types