/// <summary> /// Rents a character array from the pool. /// </summary> /// <param name="bufferPool">The character pool.</param> /// <param name="minSize">The min required size of the character array.</param> /// <returns>The character array from the pool.</returns> public static char[] RentFromBuffer(ICharArrayPool bufferPool, int minSize) { if (bufferPool == null) { return(new char[minSize]); } char[] buffer = bufferPool.Rent(minSize); return(buffer); }
/// <summary> /// Rents a character array from the pool. /// </summary> /// <param name="bufferPool">The character pool.</param> /// <param name="minSize">The min required size of the character array.</param> /// <returns>The character array from the pool.</returns> public static char[] RentFromBuffer(ICharArrayPool bufferPool, int minSize) { if (bufferPool == null) { return(new char[minSize]); } char[] buffer = bufferPool.Rent(minSize); if (buffer == null || buffer.Length < minSize) { throw new ODataException(Strings.BufferUtils_InvalidBufferOrSize(minSize)); } return(buffer); }