Const常量,必须给它初始化值。并且不能改变它。

比如publicConstdoublePi=3.1315926;

用于不需要改变值,固定结果。

ReadOnly只读,用于不确定给定的值,需要计算后才能确定。

比如:我有个背景颜色;需要判断今天是周几后给定值。

publicclassgetColor

{

publicstaticreadonlystringcolor;

staticgetColor{if(Datetime.DayOfWeek==DayOfWeek.wednesDay){color="yellow";}}

getColor(){HttpContent.current.Response.Write(color);}

}

初始化输出颜色。