[RFC] Simplify block creation pattern #4543
Labels
enhancement
The issue or pull request is an enhancement
iOS
Issues affecting Xamarin.iOS
macOS
Issues affecting Xamarin.Mac
request-for-comments
The issue is a suggested idea seeking feedback
Milestone
The current pattern generated by the generator (and which we copy around liberally), goes something like this:
I think we can make it possible to simplify this a lot, so that we get down to:
This requires:
BlockLiteral
implementIDisposable
(and callCleanupBlock
inDispose
).BlockLiteral
constructor that takes the corresponding delegates.BlockLiteral
constructor.ref BlockLiteral
instead ofvoid *
orIntPtr
(this only works if the block isn't nullable).Advantages
Disadvantages
The text was updated successfully, but these errors were encountered: