What is difference between constants and read-only
const | readonly |
---|---|
Value initialized only once at compile time | Value initialized only once at run time |
public class Const_V_Readonly
{
public const int I_CONST_VALUE = 2;
public readonly int I_RO_VALUE;
public Const_V_Readonly()
{
I_RO_VALUE = 3;
}
}