public void TestMemoryPoolStream1()
        {
            var ar = ArrayPool <byte> .Shared.Rent(16);

            Array.Fill <byte>(ar, 1);
            ArrayPool <byte> .Shared.Return(ar);

            using (var mem = new MemoryPoolStream())
            {
                for (int i = 0; i < 10; i++)
                {
                    mem.WriteByte(1);
                }

                // Пропускаем 5 байт.
                mem.Position = 15;

                mem.WriteByte(2);
            }
        }
        public void TestMemoryPoolStream2()
        {
            using (var mem = new MemoryPoolStream())
            {
                for (int i = 0; i < 10; i++)
                {
                    mem.WriteByte(1);
                }
                mem.Position = 0;
                mem.Read(new byte[3], 0, 3);
                mem.Seek(0, SeekOrigin.End);
                mem.Capacity = 20;

                var ar = new byte[10];
                Array.Fill <byte>(ar, 1);
                mem.Write(ar, 0, 10);
            }
        }