/// <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); } }
public override IEnumerable <IStackItem> GetValues() { for (int x = 0, c = Count; x < c; x++) { yield return(NativeEngine.ConvertFromNative(NeoVM.MapStackItem_GetValue(_handle, x))); } }
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)); } }
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); }