protected virtual void Finalize(){ Console.WriteLine("Parent.Finalize");} 的元数据如下:
.method family hidebysig newslot virtual
instance void Finalize() cil managed
{
// Code size 11 (0xb)
.maxstack 1
IL_0000: ldstr "Parent.Finalize"
IL_0005: call void [mscorlib]System.Console::WriteLine(string)
IL_000a: ret
} // end of method Parent::Finalize
~Parent(){ Console.WriteLine("Parent.~Parent");} 的元数据如下:
.method family hidebysig virtual instance void
Finalize() cil managed
{
// Code size 20 (0x14)
.maxstack 1
.try
{
IL_0000: ldstr "Parent.~Parent"
IL_0005: call void [mscorlib]System.Console::WriteLine(string)
IL_000a: leave.s IL_0013
} // end .try
finally
{
IL_000c: ldarg.0
IL_000d: call instance void Grandpapa::Finalize()
IL_0012: endfinally
} // end handler
IL_0013: ret
} // end of method Parent::Finalize
本文地址:http://com.8s8s.com/it/it41753.htm