5 writes to _index
Microsoft.Extensions.Caching.Hybrid (5)
Internal\RecyclableArrayBufferWriter.cs (5)
69_index = 0; 98_index += count; 112_index = 0; 145_index = 0; 209_index = 0;
16 references to _index
Microsoft.Extensions.Caching.Hybrid (16)
Internal\RecyclableArrayBufferWriter.cs (16)
46public int CommittedBytes => _index; 47public int FreeCapacity => _buffer.Length - _index; 87if (_index > _buffer.Length - count) 92if (_index + count > _maxLength) 115public ReadOnlyMemory<T> GetCommittedMemory() => new(_buffer, 0, _index); // could also directly expose a ReadOnlySpan<byte> if useful 120Debug.Assert(_buffer.Length > _index, "should have some space"); 121return _buffer.AsMemory(_index); 127Debug.Assert(_buffer.Length > _index, "should have some space"); 128return _buffer.AsSpan(_index); 132public T[] ToArray() => _buffer.AsSpan(0, _index).ToArray(); 134public ReadOnlySequence<T> AsSequence() => new(_buffer, 0, _index); 141var tmp = _index == 0 ? [] : _buffer; 142length = _index; 152length = _index; 153return _index == 0 ? [] : _buffer; 194oldArray.AsSpan(0, _index).CopyTo(_buffer);