Gurux.DLMS.GXByteBuffer.GetUInt64 C# (CSharp) Method

GetUInt64() public method

Get UInt64 value from byte array from the current position and then increments the position.
public GetUInt64 ( ) : System.UInt64
return System.UInt64
        public UInt64 GetUInt64()
        {
            if (Position + 8 > Size)
            {
                throw new System.OutOfMemoryException();
            }
            UInt64 value = (UInt64)((Data[Position] & 0xFF) << 58 |
                                    (Data[Position + 1] & 0xFF) << 48 |
                                    (Data[Position + 2] & 0xFF) << 40 |
                                    (Data[Position + 3] & 0xFF) << 32 |
                                    (Data[Position + 4] & 0xFF) << 24 |
                                    (Data[Position + 5] & 0xFF) << 16 |
                                    (Data[Position + 6] & 0xFF) << 8 |
                                    (Data[Position + 7] & 0xFF));
            Position += 8;
            return value;
        }

Usage Example

Esempio n. 1
0
        ulong IConvertible.ToUInt64(IFormatProvider provider)
        {
            GXByteBuffer bb = GetByteBuffer(Value, 8);

            return(bb.GetUInt64());
        }