ScottW discovers “using” in VB.NET Whidbey

Scott Watermasysk writes about the using statement in VB.NET Whidbey pointing out that “using … end using” will also immediately dispose of the resource you created with “using”.

Brand spanking new concept to me – since I have not even used enough C# to know that it already exists there (which I figured out *after* I read Scott’s post).

This makes me realize that I need to understand dispose a lot better than I do because outside of explicitly closing ado.net connections (in cases where they are not implicilty called – as in a datadapter.fill), I don’t really call Dispose outside of my infrequent work with unmanaged resources.

So google this: “when to call dispose .net” and you will find all kinds of msdn articles (this one is for interop though which is not so novel), interesting posts by Paul Wilson, Patrick Steele (who basically constructed the using construct all by himself in vb.net!) and others, articles on Code Project and more.

  Sign up for my newsletter so you don't miss my conference & Pluralsight course announcements!  

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.