In DotNet and C# IDisposable is primarily used to cleanup (unmanaged) resources like file handles but combined with the using statement it is also a great tool to define scopes of behavior in our code in a clean and readable way.
Source code used in this tutorial:
https://github.com/plainionist/AboutCleanCode/tree/main/ScopingIDisposable
Comments are closed.