区别:
const的值是在编译期间确定的,因此只能在声明时通过常量表达式指定其值,比如:
public const π=3.1415926;
public const DayHours=24;
像这些恒定不变的量,我们最好是用Const来声明。
static readonly是在运行时计算出其值的,所以还可以通过静态构造函数来赋值。比如:
public static string m_CurrentMdbPath;
public static string m_CurrentUserName;
像这些在程序初始化的时候才指定的量,不能用Const声明,只能用Static Readonly来声明。