#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

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #890 – Common System Exception Types that You Might Throw

  1. Pingback: Dew Drop – July 18, 2013 (#1,587) | Alvin Ashcraft's Morning Dew

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: