IDisposable Best Practices for C# Developers
IDisposable is at the heart of .NET. This course will teach you all about implementing and using IDisposable in C#, and show you what goes wrong if you don't use IDisposable, so you know why you need to use it in your solutions.
What you'll learn
IDisposable is at the heart of .NET, and it's been there since the first release. It is the only part of the framework where .NET asks for your help. If you don't use IDisposable correctly, the .NET Garbage Collector can't manage memory properly, so your app won't run efficiently, it may have strange errors, and it will eventually crash. This course will teach you all about implementing and using IDisposable in C#, and show you what goes wrong if you don't use IDisposable, so you know why you need to use it in your solutions.
Table of contents
- Introducing the Course 4m
- About IDisposable 3m
- Unmanaged Resources 3m
- Using IDisposable 2m
- Demo 1 (part 1): Using and Disposing SqlConnection 2m
- Demo 1 (part 2): Not Disposing SqlConnection 4m
- SqlConnection and IDisposable 2m
- Best Practice #1 4m
- Demo 2 (part 1): Demo Solution Walkthrough 4m
- Demo 2 (part 2): Demo Solution Failing 3m
- Module Summary 2m
- Introducing the Garbage Collector 3m
- GC Generations 3m
- When Does the GC Collect? 2m
- Demo 1 (part 1): Profiling Memory Usage 4m
- Demo 1 (part 2): Memory Usage When not Disposing 4m
- The GC in Practice 5m
- Demo 2 (part 1): Implementing IDisposable 3m
- Demo 2 (part 2): Memory Usage When Disposing 3m
- Best Practice #2 and #3 3m
- Dispose and Finalize 2m
- Demo 3 (part 1): Overriding Dispose 2m
- Demo 3 (part 2): Finalizing Unmanaged Resources 4m
- IDisposable and Inheritance 2m
- Best Practice #4 and #5 2m
- Module Summary 2m
- Diagnosing IDisposable Issues 4m
- Issues in the Word Counting App 1m
- Demo 1 (part 1): Locked File Handles 3m
- Demo 1 (part 2): Expanding Memory Profile 5m
- Finding Problems at Run-Time 2m
- Demo 2 (part 1): Static Code Analysis 3m
- Demo 2 (part 2): Fixing Rule Violations 5m
- Demo 2 (part 3): Flat Memory Profile 4m
- Finding Problems at Design-Time 3m
- Best Practice #6 3m
- Demo 3: Making IDisposable Discoverable 4m
- Best Practice #7 and #8 3m
- Module Summary 2m