C# 12 Pocket Reference by Joseph Albahari
Author:Joseph Albahari
Language: eng
Format: mobi, epub
Publisher: O'Reilly Media
Published: 2023-10-27T00:00:00+00:00
Consider the following code:
int x = 3, y = 0;
Console.WriteLine (x / y);
Because y is zero, the runtime throws a DivideByZeroException and our program terminates. We can prevent this by catching the exception as follows:
try
{
int x = 3, y = 0;
Console.WriteLine (x / y);
}
catch (DivideByZeroException)
{
Console.Write ("y cannot be zero. ");
}
// Execution resumes here after exception...
NOTE
This is a simple example to illustrate exception handling. We could deal with this particular scenario better in practice by checking explicitly for the divisor being zero before calling Calc.
Exceptions are relatively expensive to handle, taking hundreds of clock cycles.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
NET | C & C++ Windows Programming |
SQL Server | VBA |
Visual Basic |
Deep Learning with Python by François Chollet(12592)
Hello! Python by Anthony Briggs(9928)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9802)
The Mikado Method by Ola Ellnestam Daniel Brolund(9787)
Dependency Injection in .NET by Mark Seemann(9348)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8310)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7772)
Grails in Action by Glen Smith Peter Ledbrook(7705)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7567)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7169)
Microservices with Go by Alexander Shuiskov(6939)
Practical Design Patterns for Java Developers by Miroslav Wengner(6855)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6798)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6424)
Angular Projects - Third Edition by Aristeidis Bampakos(6214)
The Art of Crafting User Stories by The Art of Crafting User Stories(5730)
NetSuite for Consultants - Second Edition by Peter Ries(5661)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5474)
Kotlin in Action by Dmitry Jemerov(5074)
