English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

2006-06-08 09:05:44 · 3 answers · asked by john_mac13 1 in Computers & Internet Programming & Design

I have an array of strings:

string[] myCoworkers= { “Jon”, “Fran”, “Brian”, “Bobby”, “David”};



I would like to enumerate through it with some type of for loop, and I heard there was a way to do it without using an integer index.

2006-06-09 09:49:16 · update #1

3 answers

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

2006-06-08 09:10:20 · answer #1 · answered by jack_daniels 5 · 0 0

Could you provide some more details on what exactly you are trying to do?

Perhaps provide the array structure you are trying to enumerate...

2006-06-08 16:21:06 · answer #2 · answered by Amit M 2 · 0 0

You can always enumerate through an array like this:
int[] myNums = {5,4,3,2,1};
for (int i = 0; i < 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);

2006-06-08 22:24:39 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers