Re: [Proposal] using statement enhancements
From: Jon Skeet [C# MVP] (skeet_at_pobox.com)
Date: 03/05/05
- Next message: Jon Skeet [C# MVP]: "Re: override non-static method with a static one"
- Previous message: Jon Skeet [C# MVP]: "Re: [Proposal] using statement enhancements"
- In reply to: cody: "[Proposal] using statement enhancements"
- Next in thread: Nick Malik [Microsoft]: "Re: [Proposal] using statement enhancements"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 5 Mar 2005 17:45:53 -0000
cody <deutronium@gmx.de> wrote:
> Mostly always you use the using clause you deal with native ressources, so
> exception handlinjg is sooner or later inevitable.
Well, I don't agree that exception handling is in any way inevitable
*in the same scope as the using statement*, but I agree it happens.
> so why do we need to write
>
> try
> {
> using (File f = File.CreateText("bla.txt"))
> {
> }
> }catch (IOExcepion e)
> {
> }
>
> why don't we allow catch blocks directly attached to the using clause:
>
> using (File f = File.CreateText("bla.txt"))
> {
> }
> catch (IOExcepion e)
> {
> }
Yup, that would be nice for the cases where you *do* need to handle
exceptions at the same level.
-- Jon Skeet - <skeet@pobox.com> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
- Next message: Jon Skeet [C# MVP]: "Re: override non-static method with a static one"
- Previous message: Jon Skeet [C# MVP]: "Re: [Proposal] using statement enhancements"
- In reply to: cody: "[Proposal] using statement enhancements"
- Next in thread: Nick Malik [Microsoft]: "Re: [Proposal] using statement enhancements"
- Messages sorted by: [ date ] [ thread ]