コード例 #1
0
 public static bool TryPopAdapter <T>(this RandomAccessStack <StackItem> stack, [NotNullWhen(true)] out T?adapter)
     where T : ModelAdapters.AdapterBase
 {
     if (stack.Pop() is T _adapter)
     {
         adapter = _adapter;
         return(true);
     }
     adapter = null;
     return(false);
 }
コード例 #2
0
        public override bool TryPop(out ExecutionContextBase item)
        {
            if (_stack.Count < 1)
            {
                item = null;
                return(false);
            }

            item = _stack.Pop().ConvertFromNative();

            return(true);
        }
コード例 #3
0
        public override bool TryPop(out StackItemBase item)
        {
            if (_stack.Count < 1)
            {
                item = null;
                return(false);
            }

            item = _stack.Pop()?.ConvertFromNative();

            return(item != null);
        }
コード例 #4
0
        private string[] ResultStackToStringArray(RandomAccessStack <StackItem> stack)
        {
            int           stackSize  = stack.Count;
            List <string> stringList = new List <string>();

            for (int i = 0; i < stackSize; i++)
            {
                list.Add(stack.Pop().ToString());
            }

            // Index 0 is the "top" of the stack
            return(stringList.ToArray());
        }
コード例 #5
0
        public static bool TryPopInterface <T>(this RandomAccessStack <StackItem> stack, [NotNullWhen(true)] out T?value)
            where T : class
        {
            if (stack.Pop() is InteropInterface @interface)
            {
                var t = @interface.GetInterface <T>();
                if (t != null)
                {
                    value = t;
                    return(true);
                }
            }

            value = default;
            return(false);
        }
コード例 #6
0
ファイル: ApplicationEngine.cs プロジェクト: erikzhang/neo
 private void ApplicationEngine_ContextUnloaded(object sender, ExecutionContext e)
 {
     hashes.Pop();
 }