Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

using statement

A way to make sure a file or other resource gets closed when you're done.

A using statement or declaration calls Dispose on an IDisposable when control leaves its scope, even when an exception is thrown.

Examples

  • using var writer = new StreamWriter("log.txt"); closes the file at the end of the block, even when an exception is thrown.

Read the full section →