Source generator for IDisposable #79801
Replies: 1 comment
-
Personally, I'd prefer going kind of in the opposite direction: recommend a simple version of In particular, the commonly recommended pattern with
Inheritance is still common (though less so than in the early days of .Net), but finalizers and raw unmanaged resources should almost never be used. Which is why I think that a simpler version of the disposable pattern should be recommended, instead of hiding the unnecessarily complex version behind a source generator. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
There is a lot of boilerplate to implement the IDisposable interface correctly, the docs describes that well, but still it is a lot of boilerplate.
I think it would be much easier if this is done like the source generator
here is an example
I have been trying to achieve something like this, and I have some results that could be considered good in this repo
but of course, the .net has much higher standards than my code, It is just a proof of concept
Beta Was this translation helpful? Give feedback.
All reactions