This stack implementation stores items in a resizable array:

using System;

namespace ConsoleTest
{
    class Program
    {
        static void Main(string[] args)
        {
            Stack s = new Stack(10);

            string input = "one two three - - four five - six";

            foreach (string item in input.Split(" ".ToCharArray()))
            {
                if (item.Equals("-") && !s.IsEmpty)
                    Console.Write(s.Pop() + " ");
                else
                    s.Push(item);
            }

            Console.WriteLine("{0} items left on the stack.", s.Size);
        }

        class Stack where T : class
        {
            private T[] a; // stack entries
            private int N; // stack size

            public bool IsEmpty { get { return N == 0; } }
            public int Size { get { return N; } }

            public Stack(int capacity)
            {
                a = new T[capacity];
            }

            public void Push(T item)
            {
                // Check if the array is too small and if there is no room, double its size.
                if (N == a.Length)
                    Resize(2 * a.Length);

                // Add the item to the top of the stack.
                a[N++] = item; // set a[N]=item and then increment N
            }

            public T Pop()
            {
                // Remove the item from the top of the stack.
                T item = a[--N]; // decrement N and then assign a[N] to item; a[N] becomes an orphan
                a[N] = null; // avoid loitering by overwriting the orphaned reference

                // Half the array size if it is too large.
                // We need to check if the stack size is equal to one-fourth the array size.
                // As a result, after the array is halved, the stack will be about half full.
                if (N > 0 && N == a.Length / 4)
                    Resize(a.Length / 2);

                return item;
            }

            // Move a stack of size N <= newSize to a new array of the newSize.
            private void Resize(int newSize)
            {
                T[] tmp = new T[newSize];
                for (int i = 0; i < N; ++i)
                    tmp[i] = a[i];
                a = tmp;
            }
        }
    }
}