Skip to main content
This is lesson 15 of 15 in this module 15/15

Demo: Benchmarking Structs versus Classes

In this live walkthrough of the structs-vs-classes benchmark code, we compare memory allocation and garbage collector pressure between a list of value-type structs and a list of reference-type classes. The lesson uses the BenchmarkDotNet MemoryDiagnoser results to show that the class scenario uses 4x more memory than the structs scenario.

Video lesson

Want to watch this lesson?

This lesson is part of the study plan. Get instant access to all lectures, labs and practice exams.

Get the Study Plan