3 ms·
They're basically dual of one another. `using` is mostly more convenient, because it registers cleanup without needing extra calls, unlike `defer`. And of cou
by masklinn 1y ago
They're basically dual of one another.
`using` is mostly more convenient, because it registers cleanup without needing extra calls, unlike `defer`.
And of course you can trivially bridge callbacks, either by wrapping a function in a disposeable literal or by using the DisposableStack/AsyncDisposableStack utility types which the proposal also adds.