局部变量定义:
可以被声明为const (规则同字段)
不能被声明为static 或or
局部变量代码样式:
struct Pair
{
void okay()
{
const int answer = 42;
...
}
void compileTimeErrors()
{
const int local = call(); //错误,必须被初始化为编译时常量值
const Pair origin = ...; //错误,常量只能为简单类型,枚举,字符串
readonly Pair p = ...; //错误,只有字段才能声明为readonly
...
}
...
}
谢谢光顾:http://www.taoche.com/buycar/serial/dongfengbentiancrv/?carid=0