|
by ssmith via Blog on 6/21/2010 1:32:00 PM
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. Consider the scenario where you want to perform some kind of pre- and post- processing around an arbitrary block of code. The simplest scenario I know of is when yo
... [ read more ]
|