is that an "ok" code?
try
{ /*stuff*/ }
catch (Exception e)
{ /*stuff*/ }
finally
{
try
{ /*stuff*/ }
catch { /*empty*/ }
}
I need to do complex operation in the finally and it might crash since it's connecting to the a DB
this look weird to me, so. is this the proper way?
This is really going to depend on what you are doing, but personally, if it is truly after the other try catch and done after the operation I wouldn't nest it in a finally, just treat it as another try catch. That would remove some of the "oddity" in it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With