Eric,
You can not change the values in an enumeration while you are
enumerating through them. In order to do this, cycle through the elements,
like this:
for (int pintIndex = 0; pintIndex < arrayList.Count; ++pintIndex)
// Change the value.
arrayList[pintIndex] = ((double) arrayList[pintIndex]) * 2.1;
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"eric" <e@yahoo.com> wrote in message
news:u0**************@TK2MSFTNGP10.phx.gbl...
I have an array list with some values. I need to loop through the
arraylist and change the values. I am using the code below and I am getting an
error (like you would if i looped through a hashtable). Any ideas why?
index = 0;
foreach (object val in arrayList)
{
holeList[index] = (double)val * 2.1;
index++;
}