Ejemplo n.º 1
0
        /// <summary>
        /// Return the value for the current entry.
        /// REQUIRES: Valid()
        /// </summary>
        public byte[] Value()
        {
            int length;
            var value = LevelDBInterop.leveldb_iter_value(this.Handle, out length);

            Throw();

            var bytes = new byte[length];

            Marshal.Copy(value, bytes, 0, length);
            return(bytes);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Return the value for the current entry.
        /// REQUIRES: IsValid()
        /// </summary>
        public unsafe Byte[] Value()
        {
            IntPtr value = LevelDBInterop.leveldb_iter_value(this.Handle, out IntPtr length);

            this.Throw();

            Byte[] bytes       = new Byte[(Int64)length];
            Byte * valueNative = (Byte *)value.ToPointer();

            for (Int64 i = 0; i < (Int64)length; ++i)
            {
                bytes[i] = valueNative[i];
            }

            GC.KeepAlive(this);
            return(bytes);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Return the value for the current entry.
        /// REQUIRES: IsValid()
        /// </summary>
        public unsafe byte[] Value()
        {
            IntPtr length;
            var    value = LevelDBInterop.leveldb_iter_value(Handle, out length);

            Throw();

            var bytes       = new byte[(long)length];
            var valueNative = (byte *)value.ToPointer();

            for (long i = 0; i < (long)length; ++i)
            {
                bytes[i] = valueNative[i];
            }

            GC.KeepAlive(this);
            return(bytes);
        }