Try Catch - Finally in If statement, how to go on after ?

Posted by user313176 on Stack Overflow See other posts from Stack Overflow or by user313176
Published on 2010-04-09T20:55:32Z Indexed on 2010/04/09 21:03 UTC
Read the original article Hit count: 402

how can I do that ?

 void x()
     {....
        if (...)
        {try
            {}
            catch (ComException com)
                { throw com}
            finally  // in any case, executed fine!
                {...instructions.......}

        }
        else // not executed in case of exception because the finally can't embrace the //else too... but this block of code needs to be executed in any case too...
        {}


     }

© Stack Overflow or respective owner

Related posts about c#

Related posts about try-catch-finally