C# Memory & Types · 1 of 3
Struct layout
AtomicRepsNavigation
Where C# values live, when they are copied, and what the runtime does with them afterwards.
C# Memory & Types · 1 of 3
Struct layout
C# Memory & Types · 2 of 3
Garbage collection
C# Memory & Types · 3 of 3
Weak references
static WeakReference<List<int>> Make() => new WeakReference<List<int>>(new List<int> { 1, 2 });var w = Make();Console.WriteLine(w.TryGetTarget(out var before) + " " + (before?.Count.ToString() ?? "none"));GC.Collect();GC.WaitForPendingFinalizers();GC.Collect();Console.WriteLine(w.TryGetTarget(out var after) + " " + (after?.Count.ToString() ?? "none"));Three of the 1,100 C# Memory & Types questions.
Keep going with C# Memory & Types, free