public override object[] ToArray() { StackNode n = _stack.Value; if (n == null) { return Array.Empty<object>(); } var results = new List<object>(); do { results.Add(n.Value); n = n.Prev; } while (n != null); return results.ToArray(); } }