C# 14 · Async, errors and resources

Dispose a resource automatically

A using declaration disposes the object at the end of the enclosing scope.

using var stream = File.OpenRead("data.bin");

Official C# 14 documentation

More async, errors and resources commands

All async, errors and resources commands · C# 14 cheatsheet

Was this page helpful?