Exception from within a finally block

Posted by schrödingers cat on Stack Overflow See other posts from Stack Overflow or by schrödingers cat
Published on 2010-03-25T09:01:17Z Indexed on 2010/03/25 9:03 UTC
Read the original article Hit count: 360

Filed under:
|
|
|

Consider the following code where LockDevice() could possibly fail and throw an exception on ist own. What happens in C# if an exception is raised from within a finally block?

UnlockDevice();

try { DoSomethingWithDevice(); } finally { LockDevice(); // can fail with an exception }

© Stack Overflow or respective owner

Related posts about c#

Related posts about finally