Friday, October 28, 2011

Difference Between Throw and Throw ex

1. Throw is used to throw current exception while throw ex used to create wrapper of exception.
2. Throw ex reset the stack trace so error will appear from from the line where throw ex is written while Throw does not reset the stack trace.
3. In MSIL code, when use throw ex it will generate code as throw while throw will create code for rethrow..
4. Throw ex is used to customize the exception.