Collections public class samplesqueue public static

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: public static void PrintValues( IEnumerable myCollection ) { System.Collections.IEnumerator myEnumerator = myCollection.GetEnumerator(); while ( myEnumerator.MoveNext() ) "\ Console.Write( "\t{0}", myEnumerator.Current ); Console.WriteLine(); } } 20 Collection Classes System.Collections.Queue using System; using System.Collections; public class SamplesQueue { public static void Main() { Queue myQ = new Queue(); myQ.Enqueue("Hello"); myQ.Enqueue("World"); myQ.Enqueue("!"); Console.WriteLine( "myQ" ); "\ Console.WriteLine( "\tCount: {0}", myQ.Count ); "\ Console.Write( "\tValues:" ); PrintValues( myQ ); } public static void PrintValues( IEnumerable myCollection ) { System.Collections.IEnumerator myEnumerator = myCollection.GetEnumerator(); while ( myEnumerator.MoveNext() ) "\ Console.Write( "\t{0}", myEnumerator.Current ); Console.WriteLine(); } } Outline Introduction System Namespace Colle...
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