YairHalberstadt / stronginject

compile time dependency injection for .NET
MIT License
845 stars 24 forks source link

Permitting null instead of empty delegate for Owned<T> and AsyncOwned<T> #157

Closed jnm2 closed 2 years ago

jnm2 commented 2 years ago

What do you think about doing a one-character change to allow new Owned<X>(x, dispose: null) instead of the current options, new Owned<X>(x, dispose: () => { }); or new Owned<X>(x, dispose: null!);?

An alternative that would make this much less interesting to do would be https://github.com/YairHalberstadt/stronginject/issues/156 with Owned.WithoutDisposal(x).

YairHalberstadt commented 2 years ago

Agreed.

YairHalberstadt commented 2 years ago

Might as well do this as part of your current work on IOwned.