Example #1
0
        public void Push(T item)
        {
            var node = new LinkedNode <T>(item)
            {
                Next = head
            };

            head = node;
        }
Example #2
0
        public T Pop()
        {
            if (head == null)
            {
                throw new InvalidOperationException("No elements.");
            }

            var node = head;

            head      = head.Next;
            node.Next = null;
            return(node.Value);
        }