I am interested to look at the compiler generated code for the using
code block which generates try-finally
, but I do not see both dotPeek
and ILSpy
showing this detail. I used ildasm.exe
to look at this code block and I see that it has the try-finally
block in it but cannot understand it well...so wanted to see if these 2 tools would help.
Any ideas?
UPDATED:
So I recently used a struct which implemented IDisposable in my project and was worried if the using
code block and struct with IDisposable would cause boxing...but I later found the following article which mentioned that the compiler optimizes for this situation and does not box when trying to call Dispose.
http://ericlippert.com/2011/03/14/to-box-or-not-to-box/
So I was curious to see what kind of code does the compiler generate for my using block.