Usually,
goto
s are used to clean up resources when exiting a function. I would recommend using the
RAII[
^] idiom. It also works works well in the presence of exceptions.
For C# I would use
IDisposable
/
using
. If that's not possible, I'd use a
finally
clause to clean up.
Everything else will eventually end up being messy.