Current consolewriteline 19 collection classes other

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: " ); PrintValues( myAL );} public static void PrintValues( IEnumerable myList ) { System.Collections.IEnumerator myEnumerator = myList.GetEnumerator(); while ( myEnumerator.MoveNext() ) Console.Write("\ Console.Write("\t{0}", myEnumerator.Current ); Console.WriteLine(); } } 19 Collection Classes Other Collection Classes System.Collections.Stack Stack implementation with Push() and Pop() Fully enumerable (implements IEnumerable) System.Collections.Queue Queue with Dequeue() and Enqueue() Fully enumerable Collection Classes System.Collections.Stack using System; using System.Collections; public class SamplesStack { public static void Main() { // Create and initialize a new Stack. Stack myStack = new Stack(); myStack.Push("Hello"); myStack.Push("World"); myStack.Push("!"); Console.WriteLine( "myStack" ); "\ Console.WriteLine( "\tCount: {0}", myStack.Count ); "\ Console.Write( "\tValues:" ); PrintValues( myStack ); }...
View Full Document

This note was uploaded on 04/04/2014 for the course CS 5950 taught by Professor Staff during the Summer '08 term at Western Michigan.

Ask a homework question - tutors are online