I know that exceptions are not cheap because stack traces have to be gathered, etc. Are there any performance gains to doing this
try
{
//stuff
}
catch
{
// other stuff - don’t capture “ex”
}
instead of this?
try
{
//stuff
}
catch (Exception ex)
{
// other stuff - capture (and don’t use) “ex”
}
My guess is that the runtime still throws an exception, which entails all of the usual overhead, but I am hoping someone can confirm.