The asp.net| exception handling common language runtime (CLR) has a great advantage in that exception handling is standardized across languages. An exception that is thrown in C # can be handled in the Visual Basic client. There is no longer a hresults or ISupportErrorInfo interface.
Although the coverage of cross language exception handling is extensive, this chapter focuses entirely on C # exception handling. You slightly change the compiler's overflow behavior, and then the interesting thing begins: you handle the exception. To add more means, then raise the exception you created.
7.1 Checksum (checked) and non-checksum (unchecked) statements
When you perform an operation, it is possible that the calculated result is beyond the valid range of the result variable data type. This situation is called overflow, and depending on the programming language, you will be notified in some way-or not at all. (Does C + + programmers sound familiar?) )
So, how does C # handle overflow? To find out its default behavior, see the example of factorial I mentioned earlier in this book. (For your convenience, the previous example is shown again in Listing 7.1)
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service