Thursday, December 27, 2012

C# Exception

C# Exception

ExceptionErrors 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

Throw keywordIn 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

Member
About Us - Privacy Policy - Contact Us
@ Copyright 2013 Powered By Blogger