C# Exception
Array
Class
Collections
File
String
.NET
Algorithm
ASP.NET
Cast
Compression
Data
Delegate
Directive
Enum
Exception
If
Interface
Keyword
LINQ
Loop
Method
Number
Regex
Sort
StringBuilder
Struct
Switch
Time
Value
Windows
Errors can occur at almost any statement.
They can occur for almost any reason.
Checking for all these errors becomes unbearably complex.
Exception handling separates error-related logic.
It simplifies control flow.
Exceptions in C# provide a structured, uniform, and type-safe way of handling
both system-level and application-level error conditions.
Hejlsberg et al., p. 599
Example
In the C# language, you can throw exceptions with a throw statement.
They can also be thrown automatically by the runtime.
This usually occurs because of the values of the variables in your code.
Next:
In this program we divide by zero.
And this results in a DivideByZeroException, which is reported.

No comments:
Post a Comment