Struct RentedBuffer<T> ​
Namespace: ValveResourceFormat.Utils
Assembly: ValveResourceFormat.dll
A scratch buffer of T elements backed by an array rented from the shared byte 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 shares one set of pool buckets across all element types. 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 byte 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 RentedBuffer<T>.ByteArray.
csharp
public Span<T> Span { get; }Property Value ​
Span<T>
Methods ​
Dispose() ​
Returns the rented array to the pool.
csharp
public void Dispose()
