public unsafe void DoubleRead()
        {
            byte[] data;

            using (MemoryStream ms = new MemoryStream())
            {
                using (BinaryWriter writer = new BinaryWriter(ms))
                    for (int count = 0; count < 256; count++)
                    {
                        writer.Write((double)count);
                    }

                data = ms.ToArray();
            }

            fixed(byte *pData = data)
            {
                BinaryMemoryReader reader = new BinaryMemoryReader(pData, data.Length);

                for (int count = 0; count < 256; count++)
                {
                    Assert.AreEqual(reader.ReadDouble(), (double)count, "BinaryMemoryReader Double incompatible to BinaryWriter.");
                }
            }
        }
        public unsafe void DoubleLimits()
        {
            byte[] data;

            using (MemoryStream ms = new MemoryStream())
            {
                using (BinaryWriter writer = new BinaryWriter(ms))
                    writer.Write(133.7);

                data = ms.ToArray();
            }

            fixed(byte *pData = data)
            {
                BinaryMemoryReader reader = new BinaryMemoryReader(pData, data.Length - 1);

                try
                {
                    reader.ReadDouble();

                    Assert.Fail("Should have thrown an OutOfMemoryException.");
                }
                catch (OutOfMemoryException) { }
                catch (Exception)
                {
                    Assert.Fail("Should have thrown an OutOfMemoryException.");
                }

                BinaryMemoryWriter writer = new BinaryMemoryWriter(pData, data.Length - 1);

                try
                {
                    writer.Write(133.7);

                    Assert.Fail("Should have thrown an OutOfMemoryException.");
                }
                catch (OutOfMemoryException) { }
                catch (Exception)
                {
                    Assert.Fail("Should have thrown an OutOfMemoryException.");
                }
            }
        }