Exemplo n.º 1
0
 /// <summary>
 /// Index
 /// </summary>
 /// <param name="index">Position</param>
 /// <returns>Returns the StackItem element</returns>
 public override IStackItem this[int index]
 {
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
     get { return(NativeEngine.ConvertFromNative(NeoVM.ArrayStackItem_Get(_handle, index))); }
     [MethodImpl(MethodImplOptions.AggressiveInlining)]
     set { Set(index, value); }
 }
Exemplo n.º 2
0
 public override IEnumerable <IStackItem> GetValues()
 {
     for (int x = 0, c = Count; x < c; x++)
     {
         yield return(NativeEngine.ConvertFromNative(NeoVM.MapStackItem_GetValue(_handle, x)));
     }
 }
Exemplo n.º 3
0
        public override IEnumerator <KeyValuePair <StackItemBase, StackItemBase> > GetEnumerator()
        {
            for (int x = 0, c = Count; x < c; x++)
            {
                var key   = NativeEngine.ConvertFromNative(NeoVM.MapStackItem_GetKey(_handle, x));
                var value = NativeEngine.ConvertFromNative(NeoVM.MapStackItem_GetValue(_handle, x));

                yield return(new KeyValuePair <StackItemBase, StackItemBase>(key, value));
            }
        }
Exemplo n.º 4
0
        public override bool TryGetValue(StackItemBase key, out StackItemBase value)
        {
            var ret = NeoVM.MapStackItem_Get(_handle, key == null ? IntPtr.Zero : ((INativeStackItem)key).Handle);

            if (ret == IntPtr.Zero)
            {
                value = null;
                return(false);
            }

            value = NativeEngine.ConvertFromNative(ret);
            return(true);
        }