コード例 #1
0
        public T Pop()
        {
            if (top == null)
            {
                return(default(T));
            }
            ObjectLinkedList curr = top;

            top = (ObjectLinkedList)curr._next;
            return((T)curr._object);
        }
コード例 #2
0
        public void Push(T t)
        {
            ObjectLinkedList ll = new ObjectLinkedList()
            {
                _object = t, _next = Empty
            };

            if (top == null)
            {
                top = ll;
            }
            else
            {
                ll._next = top;
                top      = ll;
            }
            return;
        }