using System; namespace MyCollections { public class Stack //why public? { Entry top; public void Push(object data) { top = new Entry(top, data); } public object Pop() { if (top == null) throw new InvalidOperationException(); object result = top.data; top = top.next; return result; } class Entry { public Entry next; public object data; public Entry(Entry n, object d) { next = n; data = d; } } } }