Exception handling
Exception handling is the black art of doing something to repair an unpredicted error or malfunction. Within CLR, anytime something happens outside our prevision, such as setting an Int16
typed variable with a value outside valid ranges, the CLR will handle such an event by itself, creating an instance of an Exception
class and breaking the execution of our code, trying instead to find some other code able to handle (a.k.a catch
) such an exception.
Any Exception
class is populated with all useful details regarding what just happened, like a simplified error text (within the Message
property), the StackTrace
that explains exactly the whole method call hierarchy, and other details. Often, instead of a simple Exception
class, an ...
Get Learning .NET High-performance Programming 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.