標籤:
【執行個體代碼】
using System;public sealed class SomeType //-------------1{ //嵌套類 private class SomeNestedType{} //-------------2 //常量、唯讀欄位和靜態可讀/可寫欄位 private const Int32 SomeConstant = 1; //-------------3 private readonly Int32 SomeReadOnlyField = 2; //-------------4 private static Int32 SomeReadWriteField = 3; //-------------5 //類型構造器 static SomeType(){} //-------------6 //執行個體構造器 public SomeType(Int32 x){} //-------------7 public SomeType(){} //-------------8 //執行個體方法和靜態方法 private String InstanceMethod(){return null;} //-------------9 public static void Main(){} //-------------10 //執行個體屬性 public Int32 SomeProp //-------------11 { get{return 0;} //-------------12 set{} //-------------13 } //執行個體有參屬性(索引器) public Int32 this[String s] //-------------14 { get{return 0;} //-------------15 set{} //-------------16 } //執行個體事件 public event EventHandler SomeEvent; //-------------17}
【ILDasm.exe 查看上文代碼編譯的中繼資料】
下面這個是書上的,序號對應著看就行
讀經典——《CLR via C#》(Jeffrey Richter著) 筆記_通過ILDasm.exe查看編譯器如何將類型及其成員編譯成中繼資料