I'm trying to make a dynamic array in C# but I get an annoying error message. Here's my code:
private void Form1_Load(object sender, EventArgs e)
{
int[] dataArray;
Random random = new Random();
for (int i = 0; i < random.Next(1, 10); i++)
{
dataArray[i] = random.Next(1, 1000);
}
}
And the error:
Use of unassigned local variable 'dataArray'
This is just baffling my mind. I came from VB, so please me gentle, lol.
Cheers.