You're not right.
For instance:
try {
This will drown out any exception, so "no exception will pop up."
Perhaps you mean, if it is required to try / catch, to throw exceptions for the calling method or property. Not this.
For IDisposable implementations, you can use it with the operator , so objects will free up basic resources:
using(disposableObject) { }
And for others it does not implement IDisposable, you can use try / finally:
try { // Code } finally { // Do something in any case: even if an exception has been thrown. }
In any case, note that rethrowing an exception in a catch catch usually loses the contents of the stack trace , so if you need an error report with exception tracking , you need to accept in the attempt / finally approach - or use it if in a batch there are IDisposable objects - (learn more follownig of this link: http://blogs.msdn.com/b/jmstall/archive/2007/02/07/catch-rethrow.aspx )
source share