C# › Memory & Garbage Collection

What is the difference between managed and unmanaged resources?

Beginner

Answer

Managed resources are handled by the GC; unmanaged resources (file handles, sockets, native memory) are not and must be released via Dispose/finalizers.
using var file = File.OpenRead(path); // wraps an unmanaged handle
Real-world example Wrapping a native handle in an IDisposable so it's freed deterministically.