Module 07 of 12

Errors, Files & Debugging

Lessons

About This Module

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.

Lessons

4 videos
01

C# Tutorial for Beginners #29 - Error Handling with try, catch, and finally

Introduces basic error handling: the try, catch, finally statement, and how generic and specific exception handling differ.

02

C# Exception Handling Best Practices You Need to Know

Practical guidance on handling exceptions in methods with try-catch-finally, including what to catch and what to leave alone.

03

File, FileStream, StreamWriter, and StreamReader

Shows how to read and write text files using the File class, FileStream, StreamWriter, and StreamReader, and when to use each.

04

C# and Visual Studio Code Beginners Guide

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.