ECMA-334: 23. Exceptions
Microsoft .NET Framework, ASP.NET, Visual C# (CSharp, C Sharp, C-Sharp) Developer Training, Visual Studio
| C# Language Specification |
| © 2006 ECMA International |
23. Exceptions
Exceptions in C# provide a structured, uniform, and type-safe way of handling both system level and application-level error conditions. [Note: The exception mechanism in C# is quite similar to that of C++, with a few important differences:
- In C#, all exceptions shall be represented by an instance of a class type derived from
System.Exception. In C++, any value of any type can be used to represent an exception.
- In C#, all exceptions shall be represented by an instance of a class type derived from
- In C#, a finally block (§15.10) can be used to write termination code that executes in both normal execution and exceptional conditions. C++ has no equivalent construct.
- In C#, system-level exceptions such as overflow, divide-by-zero, and null dereferences have well defined exception classes and are on a par with application-level error conditions.
end note]