Start using using today! [A bit about the IDisposable interface and the using statement]

This blog has moved to a new location and comments have been disabled.

All old posts, new posts, and comments can be found on The blog of

See you there!

Comments (2)
  1. Shishir0610 says:


    I have read that the try-catch-finally block slows down the program. So, is it really a good idea that we use too many using block?

  2. David Anson says:


    It’s my understanding that *throwing and catching* an exception can introduce a bit of a performance penalty, but that simply entering/exiting a try/finally block is not itself very costly at all. In other words, try/catch/finally is not a performance issue in general, but in the exceptional (i.e., rare) case there is some cost associated with the throw/catch. For more information, I refer you to Rico Mariani’s blog post "Exception Cost: When to throw and when not to" ( There’s good info in the comments, so they’re worth reading as well. In summary, it’s my understanding that the using statement should not generally slow a program down by any noticeable amount – and the correctness/reliability/predictability benefits that you get from it are well worth that cost.

Comments are closed.