Guarantee dispose using try / finally blocks

Lots of articles have been written in the past which outline the importance of proper dispose for SharePoint SPSite and SPWeb objects in custom code.

One important topic which hasn’t been discussed very often till now is how to avoid missing a dispose in case that an error occurs during execution of custom code.

Roger Lamb has released an article today which discusses best practices about how to handle these situations in a reliable manner:

http://blogs.msdn.com/rogerla/archive/2009/01/14/try-finally-using-sharepoint-dispose.aspx

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.