There are some cases we don’t care about the Exception and just need to resume. I know it’s side-effects and …
Here my question is about the best C# syntax for ignoring an exception, for example:
try
{
// exceptional code
}
catch { }
but this seems a little ugly specially that empty brackets after catch. Is there a more elegant syntax ?
Probably not the best route, but you could do this to be a little more descriptive:
However, I think the empty brackets convey the same message to whoever is maintaining this in the future.
Better still would be to refactor your exceptional code. If you’re ignoring an exception, chances are it could (and should) be done a better way.