Saturday, August 4, 2012

using

This explains why it is better to use an using statement to automatically dispose (will happen at the end of the using statement) of an object inheirting from IDisposable instead of just calling the .Dispose() method. In a nutshell using will call Dispose even if an exception occurs before the end of the using block is reached. This is yet more magic from C# 4.0 in a Nutshell.

No comments:

Post a Comment