Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] [OT] C# question -- try / catch / finally
- Date: Thu, 21 Nov 2013 22:02:04 +0100
- From: Benjamin Tayehanpour <benjamin@example.com>
- Subject: Re: [tlug] [OT] C# question -- try / catch / finally
- References: <528E3A9C.7080606@bonivet.net>
On 21 November 2013 17:53, Godwin Stewart <gstewart@example.com> wrote: > If the finally block is executed in both cases, whether the exception is > thrown or not, what is the point in having a special construct for it at > all? Basically, if the run is interrupted for some reason (return, unhandled non-security-related exception), the finally block will still run before returning the ball to wherever. try { stupid_thing(); } catch (Exception) { return 1; } finally { return 0; } ...will return 0. The try/catch clauses will (within reason) hand the ball over to the finally clause if anything happens which causes them to, err, not happen any more. It's good for closing sockets and stuff like that.
- References:
- [tlug] [OT] C# question -- try / catch / finally
- From: Godwin Stewart
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] [OT] C# question -- try / catch / finally
- Next by Date: Re: [tlug] [OT] C# question -- try / catch / finally
- Previous by thread: Re: [tlug] [OT] C# question -- try / catch / finally
- Next by thread: Re: [tlug] [OT] C# question -- try / catch / finally
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links