HOMEBLOGDEVLOG

Inheriting disposable

Adam C. Clifton
30 Mar 2026

disposable in NLL is basically a wrapper for C# disposable. Allowing us to unload something at the moment it goes out of scope, instead of waiting for the garbage collector. This is most useful with servers and sockets during tests, as we want to quickly cleanup before the next test runs.

disposable was a bit of a quick hack when originally added, and now has been improved a bit to be aware of class inheritance so it correctly calls the base Dispose when the inherited class disposes. It also starts enforcing that classes that inherit from a disposable class must also be disposable themselves.

Previous: Create freestanding terminal apps
Next: Generate C# projects
© Numbat Logic Pty Ltd 2014 - 2026