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); }
public override bool TryPop(out ExecutionContextBase item) { if (_stack.Count < 1) { item = null; return(false); } item = _stack.Pop().ConvertFromNative(); return(true); }
public override bool TryPop(out StackItemBase item) { if (_stack.Count < 1) { item = null; return(false); } item = _stack.Pop()?.ConvertFromNative(); return(item != null); }
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()); }
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); }
private void ApplicationEngine_ContextUnloaded(object sender, ExecutionContext e) { hashes.Pop(); }