Article View: borland.public.csharpbuilder.language.csharp
Article #634Re: try catch question
From: Lord Crc
Date: Mon, 19 Jul 2004 19:59
Date: Mon, 19 Jul 2004 19:59
29 lines
1964 bytes
1964 bytes
On Mon, 19 Jul 2004 13:54:54 +0200, "Rudy Velthuis [TeamB]"
<velthuis@gmail.com> wrote:
>Yes. But once someone writes a StreamWriter derivate which does something
>additional in Close() (even if it is just logging something, for
>instance), you'll have a problem.
After thinking abit, i have to agree to a point. However, i still
think "using" is in it's place, as it will call Dispose for you (using
your argument, it should still be disposed properly), and it scopes in
the object nicely imho.
using ( StreamWriter sw = new StreamWriter(..) )
try
{
}
catch
{
}
finally
{
sw.Close();
}
Oh well, just a thought...
- Asbj�
Technical Details
Message-ID:
<1s9of05uicti69vtg74g9ca1eibiljlc4h@4ax.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<40f3748e@newsgroups.borland.com> <40F380DB.819CE161@midnightbeach.com> <40f934bb$1@newsgroups.borland.com> <s3am1jplg0p9$.dlg@marcrohloff.40tude.net> <is0jf0l76g610ajlns5154ij25vantsvp6@4ax.com> <xn0dkx9y9ftcjf013-moderator@newsgroups.borland.com> <40faddbc$1@newsgroups.borland.com> <xn0dkyerh1bs6700c-moderator@newsgroups.borland.com> <iw4h7deon4y4$.dlg@marcrohloff.40tude.net> <xn0dkyg9n3d03000n-moderator@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe35,f80ee75cfac101b9 X-Google-Attributes: gid1efe35,public X-Google-Language: ENGLISH,ASCII From: Lord Crc <lordcrc@hotmail.com> Newsgroups: borland.public.csharpbuilder.language.csharp Subject: Re: try catch question Date: Mon, 19 Jul 2004 21:59:45 +0200 Message-ID: <1s9of05uicti69vtg74g9ca1eibiljlc4h@4ax.com> References: <40f3748e@newsgroups.borland.com> <40F380DB.819CE161@midnightbeach.com> <40f934bb$1@newsgroups.borland.com> <s3am1jplg0p9$.dlg@marcrohloff.40tude.net> <is0jf0l76g610ajlns5154ij25vantsvp6@4ax.com> <xn0dkx9y9ftcjf013-moderator@newsgroups.borland.com> <40faddbc$1@newsgroups.borland.com> <xn0dkyerh1bs6700c-moderator@newsgroups.borland.com> <iw4h7deon4y4$.dlg@marcrohloff.40tude.net> <xn0dkyg9n3d03000n-moderator@newsgroups.borland.com> X-Newsreader: Forte Agent 2.0/32.646 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 80.203.48.5 X-Trace: newsgroups.borland.com 1090267130 80.203.48.5 (19 Jul 2004 12:58:50 -0700) Lines: 29 Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.maxwell.syr.edu!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail