if you want to catch an exception and ignore it, do this to avoid the compiler warning:
catch
{
//do nothing
}
instead of:
catch (Exception ex)
{
//do nothing
}
you can similarly catch exceptions of a certain type without assigning a variable to them, for example:
catch (ArgumentException)
{
//do nothing
}
instead of:
catch (ArgumentException ex)
{
//do nothing
}
No comments:
Post a Comment