C# Memory Tricks: Learn How To Master The Garbage Collector (Udemy.com)
This course teaches you advanced C# memory management tricks that every professional .NET developer must know.
Created by: Mark Farragher
Last updated May 2026
What you will learn
- Learn how the Garbage Collector works
- Master .NET memory optimization
- Discover the truth about finalizers
- Learn how to measure the memory footprint of your code
- The unexpected memory footprint of List resizing
- Structs versus classes - which one is better?
- What assumptions does the GC make about object size and lifetime?
- Manual deallocation with the Dispose pattern
- ... and much more!
How it compares
Against the other 194 rated Udemy courses in C# on CourseDuck:
- Rating4.6 out of 5higher than 76% of them
- Reviews1,741#40 of 195 by number of reviews
- Length3.5 hoursshorter than 67% of them
- Last updatedMay 2026more recently than 86% of them
Quality Score
Overall Score : 92 / 100
Course Description
Modern computers have loads of memory. But it's very easy to burn through it all in seconds if your code is not efficient about allocating and using memory.
Did you know that one simple mistake can make your code allocate 1600 times more memory than absolutely necessary?
Don't be 'that developer' who keeps crashing the development server with an OutOfMemory exception!
And you certainly don't want to be responsible for inflating the hardware budget. Can you imagine having to explain to your team that 512 GB of memory is not enough to run your code on the production server?
Let me help you.
It doesn't have to be like this. If you have a good understanding of the garbage collection process and follow a few simple best practices, you can dramatically reduce the memory footprint of your code.
Sound good?
In the last 10 years I have learned the secrets of garbage collection in .NET, and in this course I am going to share them all with you.
In a series of short lectures I will take a detailed look at the garbage collection process. I will show you all of the memory allocation problems you can expect when writing C# code, like unexpected boxing, string duplication, collection resizing, and more. I'll teach you quick and easy strategies to resolve these problems.
By the end of this course you will be able to master the garbage collector.
Why should you take this course?
You should take this course if you are a beginner or intermediate C# developer and want to take your skills to the next level. Garbage collection and memory management might sound complicated, but all of my lectures are very easy to follow and I explain all topics with clear code and many instructive diagrams. You'll have no trouble following along.
Or maybe you're working on a critical section of code in a C# project, and need to make sure your memory usage is as efficient as possible? The tips and tricks in this course will help you immensely.
Or maybe you're preparing for a C# related job interview? This course will give you an excellent foundation to answer any questions they might throw at you.
Instructor Details
- 4.6 Rating
1,741 Reviews
Mark Farragher
Mark Farragher is a blogger, investor, serial entrepreneur, and the author of 12 successful IT courses on Udemy and other marketplaces. His career spans over two decades during which Mark has been a Founder twice and CTO three times, and has launched two lean startups in The Netherlands.
Mark became a Microsoft Certified Trainer in 2005 and started training classes in .NET development, web design, and Microsoft back-office servers. Today he uses his extensive knowledge of IT to help CTO’s, architects, and other tech professionals with their leadership, communication, and technical skills.
Mark has MCSA and MCSD certifications from Microsoft and is a certified Microsoft Trainer and Scrum master. He speaks fluent English, Dutch, and German.
More courses by Mark Farragher
How To Become An Outstanding Solution Architect (2026)
4.5 (11,754 Reviews)
Provider: Udemy
Time: 7.8h
$16.99
C# Performance Tricks: How To Radically Speed Up Your Code. (2026)
4.4 (1,711 Reviews)
Provider: Udemy
Time: 4.3h
$14.99
How To Write Bulletproof Multi-Threaded C# Code (2026)
4.6 (1,417 Reviews)
Provider: Udemy
Time: 3h
$14.99
Write Asynchronous C# Code With Tasks and PLINQ (2026)
4.6 (1,017 Reviews)
Provider: Udemy
Time: 3.2h
$13.99
Boost Your C# With Structural And Creational Design Patterns (2026)
4.3 (882 Reviews)
Provider: Udemy
Time: 4.1h
$11.99
More C# courses
C# Developers: Double Your Coding Speed with Visual Studio (2018)
4.7 (4,035 Reviews)
Provider: Udemy
Time: 2.2h
$13.99
Object Oriented Programming with C# - Beginner to Advanced (2020)
4.7 (2,063 Reviews)
Provider: Udemy
Time: 5.6h
$64.99
Learn Game Development with C# Programming and MonoGame! (2025)
4.7 (1,094 Reviews)
Provider: Udemy
Time: 6.6h
$12.99
Reviews
By Anonymized User on 1/12/2023
This course is amazing, the explanations and examples are very good, I am very satisfied and already planning some use of the learnings at work. For non-native English speakers: the instructor's speech is very intelligible, I'm not a native English speaker, I'm Brazilian, and it was very easy to understand everything, so this course is also a good opportunity to train your listening skills.
By Kip Smith on 12/9/2020
This course contains a lot of useful info without dragging on forever. I was able to comprehend most of what was presented Although there were no hands-on homework assignments (I am a hands-on learner), there were some quizzes, and those were helpful. Audio was pretty decent most of the time. The visualizations were professionally done, and that was very helpful.
By Eric West on 11/15/2020
Clear instruction with deep examples of garbage collection and memory tricks. I enjoyed this course
By Uri Sheinkman on 11/1/2020
Amazing course and great instructor
By Ezequiel Macchi Mallo on 10/17/2020
Perfect explanation, and very useful information!
By Richard on 10/11/2020
Brilliant Course, I love good Theory and explanations on HOW and WHY and this course is that.
By Kyle Hardy on 9/27/2020
This course was great!
By David RIEHL on 9/24/2020
Lots of good informations for optimisation skills but it would be a good thing to practisise more
By Brianna Weaver on 9/18/2020
The instructor did a great job explaining concepts that I feel like I should have been taught in school during my collegiate level software development courses. Everything made sense and just clicked into place amongst my current knowledge of programming and C#.
By Nandakumar on 9/16/2020
Perfect explanation. Thank you
By Daniel Sansom on 8/17/2020
Very relevant content. Thinking of ways to apply these practices to my code while the lecture is still on-going. It's awesome!
By Sergio Matteoda on 8/11/2020
Clear examples.












