Understanding Exceptions

An exception occurs when a program encounters any unexpected problems such as running out of memory or attempting to read from a file that no longer exists. These problems are not necessarily caused by programming errors but mainly occur due to violations of certain assumptions that are made about the execution environment.

When a program encounters an exception, its default behavior is to throw the exception, which generally translates to abruptly terminating the program after displaying an error message. This is not a characteristic of a robust application and does not make your program popular with users. Your program should be able to handle these exceptional situations and, if possible, gracefully recover from them. ...

Get MCAD/MCSD.NET Training Guide (Exam 70-316): Developing and Implementing Windows®-Based Applications with Microsoft® Visual C#™ .NET and Microsoft® Visual Studio® .NET 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.