Real programs deal with things that go wrong: a user types the wrong input, a file is missing, a calculation fails. This module teaches you to expect problems and handle them cleanly instead of letting your application crash.
You will start with exception handling using try, catch, and finally, then learn to read and write files with the classes in System.IO. The last lesson covers debugging: setting breakpoints, stepping through code, and inspecting variables to find the cause of a bug.
Watch the lessons in order, then continue on to Modern C# Features.
Introduces basic error handling: the try, catch, finally statement, and how generic and specific exception handling differ.
Practical guidance on handling exceptions in methods with try-catch-finally, including what to catch and what to leave alone.
Shows how to read and write text files using the File class, FileStream, StreamWriter, and StreamReader, and when to use each.
Gavin Lon walks through setting up C# in Visual Studio Code and building a small application, then shows how to debug it from within the editor.