Built in Exceptions you should use

I’ve been using FxCops which looks down on “throw new Exception();”

Here are some more narrow exceptions that already exist in the framework that you should throw, hey it saves you the effort of writing a custom error class.

ArgumentNullException – Argument is null
ArgumentException – Argument not valid
ArgumentOutOfRangeException– arguement too big or small, or not on the list
ArithmeticException — The root of a negative number
InvalidOperationException -given state,

Comments are closed.