.NET Community Toolkit is a collection of helpers and APIs that work for all .NET developers and are agnostic of any specific UI platform. The toolkit is maintained and published by Microsoft, and part of the .NET Foundation.
This PR includes a couple tweaks to ImmutableArrayBuilder<T>:
Drops the ObjectPool<T> use, and just uses ArrayPool<T>. This means we can now also benefit from the automatic trimming that ArrayPool<T> implements if there is high GC pressure. Also, we're no longer reinventing the wheel here.
Make the type a ref struct, since we're never meant to pass this outside or box it.
Add ref scope annotations where needed
PR Checklist
[X] Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
[X] Based off latest main branch of toolkit
[X] PR doesn't include merge commits (always rebase on top of our main, if needed)
Overview
This PR includes a couple tweaks to
ImmutableArrayBuilder<T>
:ObjectPool<T>
use, and just usesArrayPool<T>
. This means we can now also benefit from the automatic trimming thatArrayPool<T>
implements if there is high GC pressure. Also, we're no longer reinventing the wheel here.ref struct
, since we're never meant to pass this outside or box it.PR Checklist