:
static void Main(string[] args)
{
EventHandler handler = null;
handler = delegate
{
AppDomain.CurrentDomain.ProcessExit -= handler;
};
AppDomain.CurrentDomain.ProcessExit += handler;
}
:
.method private hidebysig static void Main(string[] args) cil managed
{
.entrypoint
// Code size 51 (0x33)
.maxstack 4
.locals init ([0] class ConsoleApplication1.Program/'c__DisplayClass1' 'CS$8__locals2')
IL_0000: newobj instance void ConsoleApplication1.Program/'c__DisplayClass1'::.ctor()
IL_0005: stloc.0
IL_0006: nop
IL_0007: ldloc.0
IL_0008: ldnull
IL_0009: stfld class [mscorlib]System.EventHandler ConsoleApplication1.Program/'c__DisplayClass1'::'handler'
IL_000e: ldloc.0
IL_000f: ldloc.0
IL_0010: ldftn instance void ConsoleApplication1.Program/'c__DisplayClass1'::'b__0'(object,
class [mscorlib]System.EventArgs)
IL_0016: newobj instance void [mscorlib]System.EventHandler::.ctor(object,
native int)
IL_001b: stfld class [mscorlib]System.EventHandler ConsoleApplication1.Program/'c__DisplayClass1'::'handler'
IL_0020: call class [mscorlib]System.AppDomain [mscorlib]System.AppDomain::get_CurrentDomain()
IL_0025: ldloc.0
IL_0026: ldfld class [mscorlib]System.EventHandler ConsoleApplication1.Program/'c__DisplayClass1'::'handler'
IL_002b: callvirt instance void [mscorlib]System.AppDomain::add_ProcessExit(class [mscorlib]System.EventHandler)
IL_0030: nop
IL_0031: nop
IL_0032: ret
} // end of method Program::Main