Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Try, Catch, Finally
Message
From
18/09/2003 10:39:22
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00830232
Message ID:
00830300
Views:
20
Dmitry,

The finally {} should only be used to clean house, so to speak. It should only be used to close resources, etc. that have been opened in the try. In your previous question, where you're opening database connections,etc ... closing that connection should be just about the only thing in the finally{}. All other code should be after the finally{}. As far as execution speed, I have no idea of that.

~~Bonnie


>Now that I understand more about variable scoping as it relates to Try {} Catch {} and Finally {} and revise my page to incorporate the error trapping code, I come across the following question.
>
>In my case, it seems that I have to put a great deal of code into the Finally {} block. Almost all of the business logic (since the business mostly consists of painting the page from a couple of data readers). Is this a good programming? Or should I look for ways to make Finally block small and put most code in the after Finally block?
>
>My concern is that I don't know if ASP.NET executes code in Finally just as fast as it would in any other part of the page?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform