Edit

Share via


ArrayPool<T>.Rent(Int32) Method

Definition

Retrieves a buffer that is at least the requested length.

public:
 abstract cli::array <T> ^ Rent(int minimumLength);
public abstract T[] Rent (int minimumLength);
abstract member Rent : int -> 'T[]
Public MustOverride Function Rent (minimumLength As Integer) As T()

Parameters

minimumLength
Int32

The minimum length of the array.

Returns

T[]

An array of type T that is at least minimumLength in length.

Remarks

This buffer is loaned to the caller and should be returned to the same pool using the Return method, so that it can be reused in subsequent calls to the Rent method. Failure to return a rented buffer is not a fatal error. However, it may lead to decreased application performance, as the pool may need to create a new buffer to replace the lost one.

The array returned by this method may not be zero-initialized.

Applies to