Should my custom Exceptions Inherit an exception that is similar to them or just inherit from Exception?
c#, exception
Solution
Since inheritance is used to specify which exceptions to catch, you should respect this primarily when taking a decision.
Think of an IOException which carries additional information, or a ArgumentException other than ArgumentOutOfRangeException or ArgumentNullException.
Problem
I am creating some custom exceptions in my application. If I have an exception that gets thrown after testing the state of an argument, Or I have an Exception that gets thrown after testing that an int is within the proper range, should my exceptions inherit ArgumentException and IndexOutOfRangeException or should they just inherit Exception?