#890 – Common System Exception Types that You Might Throw

When you throw an exception, you can thrown one of the existing system exception types.  You can also throw an ApplicationException or a custom exception type that you derive from Exception.

Here are some of the more common system exception types that you might throw:

  • ArgumentException – There is a general problem with one of a method’s arguments
  • ArgumentNullException – A null value was passed in for an argument where an object was expected
  • ArgumentOutOfRangeException – An argument’s value was outside of the expected range
  • FormatException – A string-valued argument did not match the expected format
  • IndexOutOfRangeException – An argument used as an index was outside of the expected range
  • InvalidOperationException – The method called is invalid, given the current state
  • NotSupportedException – The method called is not support
  • NotImplementedException – The method called is not yet implemented (but will be at some point)
  • ObjectDisposedException – The method acts upon an object that has been disposed
Advertisements