All exceptions are either of type System.Exception or of types derived from System.Exception. Microsoft suggests that all the exceptions you use in your program derive from System.Exception, though you are also free to derive from System.ApplicationException (which was the previous recommended strategy).
The CLR System namespace includes a number of pre-defined exception types that you can use in your own programs. These exception types include ArgumentNullException, InvalidCastException, and OverflowException, as well as many others. You can guess their use based on their name. For example, ArgumentNull exception is thrown when an argument to a method is null when that is not an expected (or acceptable) value.
This chapter describes how to write your programs to catch and handle exceptions. This chapter also shows you how to use the properties of the Exception class to provide information to the user about what went wrong, and it shows you how to create and use your own custom exception types.