我已经在程序中使用了这三个字段,并在用法上有所不同,但是我对这些字段存储在何处感到有点困惑?在数据段(堆栈还是堆?)或代码段中?
static int a;
const int b=1235;
readonly int c;
Run Code Online (Sandbox Code Playgroud)
在ILDASM中,字段描述如下
对于静态:.field private静态int32 a
对于常量:.field私有静态文字int32 b = int32(0x000004D3)
对于只读:.field private initonly int32 c