GetMemory()

ArrayBufferWriter::GetMemory(int32_t) method

Returns a Memory to write to that is at least the requested length (specified by sizeHint). If no sizeHint is provided (or it’s equal to 0), some non-empty buffer is returned.

Memory<T> System::Buffers::ArrayBufferWriter<T>::GetMemory(int32_t sizeHint=0) override

Arguments

ParameterTypeDescription
sizeHintint32_tThe minimum number of elements that must be available.

Return Value

A Memory that can be written to.

Exceptions

ExceptionDescription
ArgumentExceptionIf sizeHint is negative.

Remarks

This will never return an empty Memory.

There is no guarantee that successive calls will return the same buffer or the same-sized buffer.

You must request a new buffer after calling Advance to continue writing more data and cannot write to a previously acquired buffer.

See Also