order of exception catching?

.net, exception

Solution

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 `YourFunkyException` inherits from `UnauthorizedAccessException` directly or indirectly), then it won't matter.

- "Design Guidelines for Exceptions" at http://msdn.microsoft.com/en-us/library/ms229014.aspx

- "Handling and Throwing Exceptions" at http://msdn.microsoft.com/en-us/library/5b2yeyab.aspx.

Problem

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 :)

Original source