Пример #1
0
        static void EnsureCapacityCore <T>(ref T[] array, int index, ArrayPool <T> pool)
        {
            if (array.Length <= index)
            {
                var newSize  = array.Length * 2;
                var newArray = pool.Rent((index < newSize) ? newSize : (index * 2));
                Array.Copy(array, 0, newArray, 0, array.Length);

                pool.Return(array, clearArray: !RuntimeHelpersAbstraction.IsWellKnownNoReferenceContainsType <T>());

                array = newArray;
            }
        }
Пример #2
0
 public void Dispose()
 {
     DisposeManually(!RuntimeHelpersAbstraction.IsWellKnownNoReferenceContainsType <T>());
 }