2021-03-29 14:54:12 +08:00
|
|
|
|
namespace LC.Newtonsoft.Json
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Provides an interface for using pooled arrays.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T">The array type content.</typeparam>
|
|
|
|
|
public interface IArrayPool<T>
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Rent an array from the pool. This array must be returned when it is no longer needed.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="minimumLength">The minimum required length of the array. The returned array may be longer.</param>
|
|
|
|
|
/// <returns>The rented array from the pool. This array must be returned when it is no longer needed.</returns>
|
|
|
|
|
T[] Rent(int minimumLength);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Return an array to the pool.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="array">The array that is being returned.</param>
|
2021-03-30 10:54:25 +08:00
|
|
|
|
void Return(T[] array);
|
2021-03-29 14:54:12 +08:00
|
|
|
|
}
|
|
|
|
|
}
|