public int Pop()
        {
            if (top == null)
            {
                return(-1);
            }

            var val = top.value;

            top      = top.prev;
            top.next = null;
            return(val);
        }
        public void Push(int val)
        {
            if (top == null)
            {
                top = new stacknode(val);
                return;
            }

            var temp = new stacknode(val);

            temp.prev = top;
            top.next  = temp;
            top       = temp;
        }