Make sure the Close() methods are inside a finally block so that it will always be executed.
When shutting connections down (or opening them) it is vital that they return to the state before the exception.
For example:
try { a(); b(); Close(); } catch (...) { }
If a() or b() throw an exception, it'll never be closed, for example...
Make sure the Close() methods are inside a finally block so that it will always be executed.
When shutting connections down (or opening them) it is vital that they return to the state before the exception.
For example:
try { a(); b(); Close(); } catch (...) { }If a() or b() throw an exception, it'll never be closed, for example...