lets say I have a System exception like UnauthorizedAccessException and an exception which I have written myself. Is there a certain order that I have to use whn catching the exceptions? I guess its still from the most specific to the least specific?
Thanks 🙂
They are caught in the order as-written, so put the most specific (in terms of inheritance between exception types) first.
Since it is the type that matters (and the inheritance hierarchy); if the two don’t have an inheritance relationship (i.e. it is not the case that
YourFunkyExceptioninherits fromUnauthorizedAccessExceptiondirectly or indirectly), then it won’t matter.