Exemplo n.º 1
0
        /// <summary>
        /// Return the key for the current entry.
        /// REQUIRES: IsValid()
        /// </summary>
        public Byte[] Key()
        {
            IntPtr key = LevelDBInterop.leveldb_iter_key(this.Handle, out IntPtr length);

            this.Throw();

            Byte[] bytes = new Byte[(Int32)length];
            Marshal.Copy(key, bytes, 0, (Int32)length);
            GC.KeepAlive(this);
            return(bytes);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Return the key for the current entry.
        /// REQUIRES: Valid()
        /// </summary>
        public byte[] Key()
        {
            int length;
            var key = LevelDBInterop.leveldb_iter_key(this.Handle, out length);

            Throw();

            var bytes = new byte[length];

            Marshal.Copy(key, bytes, 0, length);
            return(bytes);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Return the key for the current entry.
        /// REQUIRES: IsValid()
        /// </summary>
        public byte[] Key()
        {
            IntPtr length;
            var    key = LevelDBInterop.leveldb_iter_key(Handle, out length);

            Throw();

            var bytes = new byte[(int)length];

            Marshal.Copy(key, bytes, 0, (int)length);
            GC.KeepAlive(this);
            return(bytes);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Return the key for the current entry.
        /// REQUIRES: Valid()
        /// </summary>
        public int KeyAsInt()
        {
            int length;
            var key = LevelDBInterop.leveldb_iter_key(this.Handle, out length);

            Throw();

            if (length != 4)
            {
                throw new Exception("Key is not an integer");
            }

            return(Marshal.ReadInt32(key));
        }