Friday, May 21, 2010

How do i enumerate an array in c#?

this might be some help. Go through the code and read where the number get enumerated.

How do i enumerate an array in c#?
Could you provide some more details on what exactly you are trying to do?





Perhaps provide the array structure you are trying to enumerate...
Reply:You can always enumerate through an array like this:


int[] myNums = {5,4,3,2,1};


for (int i = 0; i %26lt; 5; i++)


Console.Out.WriteLine(myNums[i]);








But I think you are talking about collections:





string[] myList = { "Item1", "Item2", "Item3", "Item4" };


foreach (string myItem in myList)


Console.Out.WriteLine(myItem);


No comments:

Post a Comment