foreach loop
double[] pArray= new double[50];
foreach (int i in problem7Array)
{
pArray[i]= i * 1.13;
}
how come i never get's incremented and stays at 0 for all 50 iterations?
Steve
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Binu SubiPosted Feb 15, 2006, 4:15 PM
when you are using foreach,
int i represents an item in the collection
further more if it is a value type (like in your case int) it is read only
foreach basically repeats a group of statements for each value in a collection
Cheers!
will hePosted Feb 15, 2006, 11:11 AM