How to catch all exceptions in c# using try and catch?
Both approaches will catch all exceptions. There is no significant difference between your two code examples except that the first will generate a compiler warning because ex is declared but not used. But note that some exceptions are special and will be rethrown automatically. ThreadAbortException is a special exception that can be caught, but it will automatically be … Read more