You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 regels
540 B

  1. using System.Buffers;
  2. namespace JT1078.Protocol
  3. {
  4. internal static class JT1078ArrayPool
  5. {
  6. private readonly static ArrayPool<byte> ArrayPool;
  7. static JT1078ArrayPool()
  8. {
  9. ArrayPool = ArrayPool<byte>.Create();
  10. }
  11. public static byte[] Rent(int minimumLength)
  12. {
  13. return ArrayPool.Rent(minimumLength);
  14. }
  15. public static void Return(byte[] array, bool clearArray = false)
  16. {
  17. ArrayPool.Return(array, clearArray);
  18. }
  19. }
  20. }