Lets say I need to run methodA and methodA will throw a FormatException.
If I write this block:
try { methodA(); } catch (Exception ex) { methodB(); } catch (FormatException ex) { methodC(); } Will it ever run methodC, knowing that FormatException is also an Exception and therefor will go into the catchblock of methodB.
Or is it better to write it like this:
try { methodA(); } catch (Exception ex) { if(ex is FormatException) { methodC(); } else { methodB(); } }