Practical Inheritance: Building Custom Exceptions

In Chapter 6, “Error Handling and Exceptions,” you learned about exceptions in .NET development; you saw what exceptions are and how you can intercept exceptions at runtime to create well-formed applications that can handle errors. The .NET Framework ships with hundreds of exceptions related to many aspects of .NET development. There could be situations in which you need to implement custom exceptions. Building custom exceptions is possible due to inheritance. A custom exception can inherit from the root System.Exception class or from another exception (such as System.IO.IOException) that necessarily inherits from System.Exception. Custom exceptions should always be CLS-compliant. Let’s retake ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.