consolewriteline nafter copying the first two

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: irst two elements from the int array to the Object array. Array.Copy( myIntArray, myObjArray, 2 ); // Print the values of the modified arrays. "\ Console.WriteLine( "\nAfter copying the first two elements of the int array to the Object array," ); Console.Write( "int array: " ); PrintValues( myIntArray ); Console.Write( "Object array:" ); PrintValues( myObjArray ); // Copy the last two elements from the Object array to the int array. Array.Copy( myObjArray, myObjArray.GetUpperBound(0) - 1, myIntArray, myIntArray.GetUpperBound(0) - 1, 2 ); } 16 Collection Classes Collections Interfaces IEnumerable Supports simple iteration over the collection GetEnumerator() returns IEnumerator iterator IEnumerator: Current, MoveNext(), Reset() IEnumerator Iterator for enumerable collections Properties and methods: Current(), MoveNext(), Reset() Collection Classes Enumerating a Set of Items All types offer standard mechanism for item iteration System.Collections.IEnumerable interface public interface IEnumerable { IEnumerator GetEnumerator(); } GetEnumerator returns object dedicated to item iteration public interface IEnumerator { Boolean MoveNext(); Object Current { get; } void Reset(); } 17 Collection Classe...
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