Re: Is this pattern OK?
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Fri, 18 Jan 2008 19:32:21 -0000
Ben Voigt [C++ MVP] <rbv@xxxxxxxxxxxxx> wrote:
<snip>
What you ought to do instead is convert try / finally { Dispose(); } into
using blocks, which automatically handle the null case.
They also cope with the possibility of Dispose calls throwing
exceptions - with a single finally block, if an early Dispose call
fails, the rest won't get executed.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
.
- Follow-Ups:
- Re: Is this pattern OK?
- From: richard.markiewicz@xxxxxxxxxxxx
- Re: Is this pattern OK?
- References:
- Is this pattern OK?
- From: richard.markiewicz@xxxxxxxxxxxx
- Re: Is this pattern OK?
- From: Ben Voigt [C++ MVP]
- Is this pattern OK?
- Prev by Date: Re: C# Plugin system - same interface in two different assemblies...
- Next by Date: Re: My silliest extention made yet 2008...
- Previous by thread: Re: Is this pattern OK?
- Next by thread: Re: Is this pattern OK?
- Index(es):
Relevant Pages
|