Easier debugging with System.Diagnostics.Debug
Channel: Peter
Date: 2021-03-03

In this video, I'm going to demonstrate the usage of System.Diagnostics.Debug class in C#.
NOTE:
I looked it up and the Debug.* statements will be in the compiled IL, however, the calls will be omitted, since the methods have a [Conditional("DEBUG")] attribute.
You can see for yourself in the source code of .NET Framework 4.8:
https://referencesource.microsoft.com/#System/compmod/system/diagnostics/Debug.cs,a8985bcd723aa068


Chapters:

00:00 - Intro
01:00 - Project Overview
03:28 - Explaining Environment.SpecialFolder
03:57 - Showcasing an example exception
05:12 - Common ways of preventing exceptions
06:15 - Debug.Assert
09:57 - Debug statements don't run in Release
11:35 - Debug.WriteLine
13:15 - Adding Trace Listeners
15:28 - AutoFlush and Flush
19:35 - Write line IF
21:08 - Indent & Unindent
23:15 - Boolean Switch
28:28 - Debug.Fail
30:46 - Outro