December 2018
Beginner to intermediate
668 pages
15h 30m
English
You've seen several scenarios when errors have occurred when converting types. C# calls this, an exception has been thrown.
Good practice is to avoid writing code that will throw an exception whenever possible, perhaps by performing if statement checks, but sometimes you can't. In those scenarios, you must catch the exception and handle it.
As you have seen, the default behavior of a console application is to display details about the exception in the output and then stop running the application.
You can take control over how to handle exceptions using the try statement.
Read now
Unlock full access