Struct RentedBuffer<T> ​
Namespace: ValveResourceFormat.Utils
Assembly: ValveResourceFormat.dll
A scratch buffer of T elements backed by an array rented from the shared pool.
csharp
public readonly ref struct RentedBuffer<T> where T : unmanagedType Parameters ​
T
Element type the buffer is written as.
Remarks ​
Renting bytes for every element type keeps all scratch buffers in the same pool buckets instead of one set of buckets per element type. Dispose (preferably with using) to return the array to the pool.
Constructors ​
RentedBuffer(int) ​
Rents a buffer of count elements.
csharp
public RentedBuffer(int count)Parameters ​
count int
Number of T elements to fit.
Properties ​
ByteArray ​
Gets the rented array, for APIs that take a array. The pool hands out whole buckets, so this is usually longer than requested.
csharp
public byte[] ByteArray { get; }Property Value ​
byte[]
Span ​
Gets the requested elements. Exactly the requested length, unlike .
csharp
public Span<T> Span { get; }Property Value ​
Span<T>
Methods ​
Dispose() ​
Returns the rented array to the pool.
csharp
public void Dispose()
