Is there a way to handle error in a try-catch-finally if the error occurs after the finally block?
-
29-10-2019 - |
Question
I was just curious. I have just written my first major code in C#, using try-catch-finally. I was wondering if there existed such a method to handle errors if there was additionally stuff to be processed after inside the finally block. Thanks.
Solution
You could nest another try-catch block in your finally clause (if I understand your question correctly):
try
{
...
}
catch
{
...
}
finally
{
try
{
...
}
catch
{
...
}
}
OTHER TIPS
i know nothing about c but logic tell me if your are outside the try-catch-finally you are out of the scope of that conditional statement and therefore need a new try-catch-finally or something similar
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow