const和readonly都是只读的。但是const修饰的变量必须在声明时赋值。readonly修饰的变量可以在声明时或者构造函数里赋值。private const double pi=3.14;class A { private readonly int a; public A(int v) { a=v; } }