I have a try and catch where I am catching different error types:
catch (XmlException XmlExp)
{
return false;
}
catch (XmlSchemaException XmlSchExp)
{
return false;
}
catch (Exception GenExp)
{
throw GenExp;
}
Notice that XMLException XMLExp is declared but never used. Is it possible to catch the XMLException without declaring a local variable?
Is this valid code:
catch (XmlException)
{
return false;
}
Yes, like this
catch (XmlException)
{
return false;
}
catch (XmlSchemaException)
{
return false;
}
catch (Exception GenExp)
{
// inspect or use GenExp
throw;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With