1.

What is the difference between the “throw” and “throw ex” in .NET?

Answer»

In THROW, the original EXCEPTION stack information is retained.

Example:

For Throw :

try

{ //  some operation that can FAIL } catch (Exception ex) { throw; }

For Throw Ex:

In Throw Ex the original information is overridden by the External information and you will LOSE the original information.

try { // do some operation that can fail } catch (Exception ex) { // do some local cleanup throw; }


Discussion

No Comment Found