Lidgren.Network.NetIncomingMessage.PeekDouble C# (CSharp) Method

PeekDouble() public method

Reads a 64-bit Double without advancing the read pointer
public PeekDouble ( ) : double
return double
        public double PeekDouble()
        {
            NetException.Assert(m_bitLength - m_readPosition >= 64, c_readOverflowError);

            if ((m_readPosition & 7) == 0) // read directly
            {
                // read directly
                double retval = BitConverter.ToDouble(m_data, m_readPosition >> 3);
                return retval;
            }

            byte[] bytes = PeekBytes(8);
            return BitConverter.ToDouble(bytes, 0); // endianness is handled inside BitConverter.ToSingle
        }