C# 靜態建構函式編譯為 .cctor;實例建構函式為 .ctor。無參數建構函式會自動產生。
.method public hidebysig static void vijay() il managed {
.entrypoint
ldstr "hi"
call void System.Console::WriteLine(class System.String)
newobj instance void zzz::.ctor()
pop
ret
}
.method private hidebysig specialname rtspecialname instance void .ctor() il managed {
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ldstr "bye"
call void [mscorlib]System.Console::WriteLine(class System.String)
ret
}
輸出:hi → bye