Reputation: 15
Hi I'm not to sure how to do this but here's the code that I've got
// splits 1 to 3
int check;
for (int i = 0; i < 100; i++)
{
check = alM1((rand.next(20))+1);//error
if (!(alM3.Contains(check)))
alM3.Add(check);
if (alM3.Length == 10)
break;
}
// removes 3 from 1
for (int i = 0; i < 10; i++)
{
if (alM1.Contains(alM3(i))) //error
alM1.Remove(alM3(i)); //error
}
The error message says ArrayList is a variable but it is used like a method. How can I write it so it produces what I want. Thank in advance T
Upvotes: 0
Views: 127
Reputation: 1870
To access entries of the list you need to use square bracket notation. For example:
check = alM1[(rand.next(20))+1];
and:
if (alM1.Contains(alM3[i]))
Upvotes: 1