TC39 Explicit Resource Management (using) support.
Adds a disposable and returns it.
Adding to an already-disposed collection disposes the value immediately instead of leaking it (mirroring VS Code's own DisposableStore); no error is thrown.
Disposes everything in reverse (LIFO) order.
A failing dispose() never stops the rest. A single collected error is
rethrown as-is; several are wrapped in an AggregateError — so partial
cleanup never silently succeeds.
Adds one or more disposables. Like add when already disposed.
A collection of disposables that can be disposed together.
Supports TC39 Explicit Resource Management:
using scope = new DisposableCollection()disposes everything when the block exits, even on exceptions.Example