I wish to know what this program is try to say.
using System;
using System.Collections;
class MainClass
{
static void Main()
{
int[] intArray = { 10, 11, 12, 13 };
IEnumerator ie = intArray.GetEnumerator();
while (ie.MoveNext() == true)
{
int i = (int)ie.Current;
Console.WriteLine("{0}", i);
}
Console.Read();
}
}
/*
10
11
12
13
*/
Loading

VulpesRank #55 · 29.2K reputationPosted May 14, 2014, 5:20 AM EDT
Posted May 14, 2014, 6:23 AM EDT
Posted May 14, 2014, 10:48 AM EDT
int i = (int)ie.Current;
Console.WriteLine("{0}", i);
with this
Console.WriteLine("{0} ", ie.Current);
Casting is not necessary. Please explain why?
VulpesRank #55 · 29.2K reputationPosted May 14, 2014, 11:32 AM EDT
Posted May 15, 2014, 4:25 AM EDT