static void Main(string[] args) { // create a stack that will hold any value type GenericStack <ValueType> valueStack = new GenericStack <ValueType>(); // push some values into the stack valueStack.Push(10L); valueStack.Push(23.34f); valueStack.Push(-100); valueStack.Push(512); // filter the stack so that we only get int values GenericStack <int> intStack = valueStack.FilterStack <int>(); // print out the contents of the filtered stack do { Console.WriteLine("Filtered value: {0}", intStack.Pop()); } while (intStack.Count > 0); // wait for input before exiting Console.WriteLine("Press enter to finish"); Console.ReadLine(); }