Derik Whittaker

Syndication

News


Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Don't return in a finally clause – Using .Net
There is a post on DZone today about having a return statement in a finally block. When I first read the code it thought it was odd that this was even allowed.  Not to mention that any sane, rational developer would put a return in a finally block.  I did not really believe the author when he explained the execution path either, so I thought I would give it a try.

I fired up my handy, dandy .Net IDE and threw down some code.  At this point I noticed that .net DOES NOT ALLOW you to put a return (or break) inside a finally block.  In fact you get a message that states ‘Cannot jump out of the finally block’.  I thought this was odd that I got this but the author did not.

It was at this point that I noticed he was coding in Java.  Wow, must suck that a language like Java allows for really shitty practices like allowing a return in a finally block.  I was happy to find out that .net does NOT allow this.

kick it on DotNetKicks.com

Posted 06-29-2007 1:18 PM by Derik Whittaker
Filed under:

[Advertisement]

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)