Skip to content

Instantly share code, notes, and snippets.

@luisxkimo
Created March 24, 2014 16:37
Show Gist options
  • Select an option

  • Save luisxkimo/9743998 to your computer and use it in GitHub Desktop.

Select an option

Save luisxkimo/9743998 to your computer and use it in GitHub Desktop.
IL associate to TestUsingStatement
.method private hidebysig static void Main(string[] args) cil managed
{
.entrypoint
// Code size 65 (0x41)
.maxstack 3
.locals init ([0] class PruebasUsingStatement.MyObject obj1,
[1] class PruebasUsingStatement.MyObject obj2)
IL_0000: ldstr "Uno"
IL_0005: ldc.i4.0
IL_0006: newobj instance void PruebasUsingStatement.MyObject::.ctor(string,
bool)
IL_000b: stloc.0
.try
{
IL_000c: ldstr "Dos"
IL_0011: ldc.i4.1
IL_0012: newobj instance void PruebasUsingStatement.MyObject::.ctor(string,
bool)
IL_0017: stloc.1
.try
{
IL_0018: ldstr "Hemos entrado en el using"
IL_001d: call void [mscorlib]System.Console::WriteLine(string)
IL_0022: leave.s IL_002e
} // end .try
finally
{
IL_0024: ldloc.1
IL_0025: brfalse.s IL_002d
IL_0027: ldloc.1
IL_0028: callvirt instance void [mscorlib]System.IDisposable::Dispose()
IL_002d: endfinally
} // end handler
IL_002e: leave.s IL_003a
} // end .try
finally
{
IL_0030: ldloc.0
IL_0031: brfalse.s IL_0039
IL_0033: ldloc.0
IL_0034: callvirt instance void [mscorlib]System.IDisposable::Dispose()
IL_0039: endfinally
} // end handler
IL_003a: call string [mscorlib]System.Console::ReadLine()
IL_003f: pop
IL_0040: ret
} // end of method Program::Main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment