Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Exception’s Children

There are dozens, perhaps hundreds, of exception classes defined in the .NET Framework library. Most of them have the same properties and methods, but the class names themselves help you (and your code) understand what’s gone wrong. (We’ll talk about designing and implementing classes your own classes in detail starting in the next chapter.) For now, you need to know that classes can inherit from one another in a hierarchy, and that you can always treat a child class as though it were the parent, but the reverse is not true. That means that whatever you catch, you can just treat it as an Exception.

The diagram below shows a few of the exception classes you’re likely to work with. The arrows show that, for example, SystemException inherits from Exception, and OverflowException inherits directly from ArgumentException, indirectly from SystemException and, ultimately Exception.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free 10-Day Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint