Description
Issue Details
After looking at the code base currently, I noticed that this generator does not yet generate a foreach
dispose loop for disposing of disposables that exist inside of a collection type. This must have been something I been overlooking as I rarely use collections to store disposables unless I am using Windows Forms and need to dispose of Windows Forms controls.
Is your feature request related to a problem? Please describe.
It's related to manual code can dispose of disposables using a loop that are disposed in a collection. All of the disposable work I feel should be source generated to ensure that everything is properly disposed of.
Describe the solution you'd like
For the source generator to properly generate the dispose loop for a collection that contains disposable objects. I am thinking an attribute for marking the collection would be sufficient as well.
Describe alternatives you've considered
Other than having the person tell the source generator to run their special function for disposing of items inside of said collection, I feel the best option would be to instead add direct support for it and then consider the future of having the special function attributes for running them on dispose.
Additional context
Implementing this would simplify C# code like this by generating it: dotnet/reproducible-builds#50