Exemple #1
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);
        }
Exemple #2
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));
        }