Friday, February 09, 2007

Finally...

It is not limited to PL/SQL!

How to do the logical equivalent of:

when others
then null;
end;

In C#.  Brilliant :)

POST A COMMENT

7 Comments:

Blogger SeanMacGC said....

Yes, crap programming is fully portable!

Fri Feb 09, 07:30:00 AM EST  

Blogger Rob Baillie said....

I've never done any C#, and it's been a long time since I've done any Java, but wouldn't the equivalent actually be:

try {
// stuff
}
catch(Exception ex) {
}

rather than:

try {
// stuff
}
finally {
}

Fri Feb 09, 08:53:00 AM EST  

Anonymous MyDUL said....

I don't think you need to know C#.

Fri Feb 09, 08:58:00 AM EST  

Anonymous Mark A. Williams said....

rob baillie said...

"...but wouldn't the equivalent actually be..."

Yes. The exception will still be thrown. In a "release" build the empy "finally" block will be optimized away as well.

- Mark

Fri Feb 09, 09:23:00 AM EST  

Anonymous Anonymous said....

exactly.

when others
then null;
end;

is completely different from

try {
// stuff
}
finally {
}

Fri Feb 09, 09:37:00 AM EST  

Anonymous SwitchBL8 said....

Ditto. Like the others said: an empty "finally" is something else than a catch-all-empty-exception-handler.

The empty finally is probably created by keyboard-shortcuts in the IDE.

Fri Feb 09, 10:26:00 AM EST  

Anonymous Anonymous said....

The empty finally is probably created by keyboard-shortcuts in the IDE.

I doubt it - a shortcut would have "catch" as well.

Fri Feb 09, 02:25:00 PM EST  

POST A COMMENT

<< Home