Memory & GC · interview question
What does a using statement (or using var declaration) guarantee?
Multiple choiceEasy
Answer and explanation
Correct answer
A. Dispose() is called when the scope exits, even if an exception is thrown.
Why
using compiles to try { ... } finally { obj?.Dispose(); }, so unmanaged resources such as file handles and connections are released deterministically.
Test yourself on Memory & GC
A free test with instant, explained results. No account needed.