Explore Library
Flashcard

GC vs IDisposable

The GC reclaims managed memory automatically, but IDisposable exists to release unmanaged resources deterministically.

Question

If the GC frees memory automatically, why do we need IDisposable and Dispose()?

Click to reveal answer