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)
46
public int CommittedBytes =>
_index
;
47
public int FreeCapacity => _buffer.Length -
_index
;
87
if (
_index
> _buffer.Length - count)
92
if (
_index
+ count > _maxLength)
115
public ReadOnlyMemory<T> GetCommittedMemory() => new(_buffer, 0,
_index
); // could also directly expose a ReadOnlySpan<byte> if useful
120
Debug.Assert(_buffer.Length >
_index
, "should have some space");
121
return _buffer.AsMemory(
_index
);
127
Debug.Assert(_buffer.Length >
_index
, "should have some space");
128
return _buffer.AsSpan(
_index
);
132
public T[] ToArray() => _buffer.AsSpan(0,
_index
).ToArray();
134
public ReadOnlySequence<T> AsSequence() => new(_buffer, 0,
_index
);
141
var tmp =
_index
== 0 ? [] : _buffer;
142
length =
_index
;
152
length =
_index
;
153
return
_index
== 0 ? [] : _buffer;
194
oldArray.AsSpan(0,
_index
).CopyTo(_buffer);