In C#, I can use the throw; statement to rethrow an exception while preserving the stack trace:
throw;
try { ... } catch (Exception e) { if (e is
I would prefer:
try { ... } catch (FooException fe){ throw fe; } catch (Exception e) { // Note: don't catch all exceptions like this unless you know what you // are doing. ... }