Great Uses of Using Statement in C#

added by sahi
6/22/2010 1:53:21 AM

2 Kicks, 82 Views

In my last post about testing emails in .NET, I noted the use of the using statement to ensure safe usage of the IDisposable SmtpClient and MailMessage objects. This is the typical usage of the using statement, but you can take advantage of this statement’s behavior for other scenarios as well, resulting in cleaner code.