5 writes to _index
Microsoft.Extensions.Caching.Hybrid (5)
Internal\RecyclableArrayBufferWriter.cs (5)
61
_index
= 0;
69
_index
= 0;
97
_index
+= count;
111
_index
= 0;
142
_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
;
53
Debug.Assert(obj.
_index
== 0, "index should be zero initially");
87
if (
_index
> _buffer.Length - count)
92
if (
_index
+ count > _maxLength)
114
public ReadOnlyMemory<T> GetCommittedMemory() => new(_buffer, 0,
_index
); // could also directly expose a ReadOnlySpan<byte> if useful
119
Debug.Assert(_buffer.Length >
_index
, "should have some space");
120
return _buffer.AsMemory(
_index
);
126
Debug.Assert(_buffer.Length >
_index
, "should have some space");
127
return _buffer.AsSpan(
_index
);
131
public T[] ToArray() => _buffer.AsSpan(0,
_index
).ToArray();
138
var tmp =
_index
== 0 ? [] : _buffer;
139
length =
_index
;
149
length =
_index
;
150
return
_index
== 0 ? [] : _buffer;
191
oldArray.AsSpan(0,
_index
).CopyTo(_buffer);