Does anybody know if it's possible to write the code in the catch block below as a single statement? I haven't been able to come up with a way, and was just curious if there was one.
IMPORTANT: the stack trace must be preserved.
catch (Exception e)
{
if (e is MyCustomException)
{
// throw original exception
throw;
}
// create custom exception
MyCustomException e2 =
new MyCustomException(
"An error occurred performing the calculation.", e);
throw e2;
}