ToInt16() public static method

Constructs a System.Int16 from bytes at a given offset in a byte array.
public static ToInt16 ( byte array, int startIndex ) : short
array byte The array with the bytes to use.
startIndex int The offset at which the number starts.
return short
        private bool TryReadInt16(out short value, bool peek)
        {
            if (CanAdvance(2))
            {
                int start = _currentOffset;
                if (!peek)
                {
                    UncheckedAdvance(2);
                }

                value = LittleEndianBitConverter.ToInt16(_buffer, start);
                return(true);
            }
            else
            {
                return(Misc.Fail(out value));
            }
        }
        private short ReadInt16(bool peek)
        {
            int start;

            if (peek)
            {
                // If we just wanna peek, don't advance.
                if (!CanAdvance(2))
                {
                    throw PacketReadingException.EndOfStream();
                }

                start = _currentOffset;
            }
            else
            {
                // Otherwise do advance.
                start = CheckedAdvance(2);
            }

            return(LittleEndianBitConverter.ToInt16(_buffer, start));
        }