// in general i take random colors from an Enum and insert that into a new array. when i ask by BoxMessage inside the loop For each Array[i] i get random colors as expected. If i comment (\) the message box and ask for Array[1-5] outside the loop, i get the same color for all 5 message box. I believe it related to the fact that my message box inside the loop successfully convert the Enum into a string, when i tried to convert the whole array in the loop ( array[i].ToString(); ) it didn't quite work. please advise....
public void GetArray()
{
array = new EnumColor[5];
for (int i = 0; i < 5; i++)
{
rnd = new Random();
int rndnum = rnd.Next(0, 4);
array[i] = (EnumColor)rndnum;
MessageBox.Show(array[i].ToString());
}
MessageBox.Show(array[0].ToString());
MessageBox.Show(array[1].ToString());
MessageBox.Show(array[2].ToString());
MessageBox.Show(array[3].ToString());
MessageBox.Show(array[4].ToString());
}