John said:
I dont get what you are saying, because if I do this
ArrayList someList = new ArrayList();
someList.Add("test");
I will get the same error.
Look at this:
C:\>type z1.cs
using System;
using System.Collections;
public class Z1
{
ArrayList customerArray = new ArrayList();
customerArray.Add("Tester");
customerArray.Add("Testing");
}
C:\>csc /t:library z1.cs
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.1433
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.
z1.cs(7,22): error CS1519: Invalid token '(' in class, struct, or interface
member declaration
z1.cs(8,22): error CS1519: Invalid token '(' in class, struct, or interface
member declaration
C:\>type z2.cs
using System;
using System.Collections;
public class Z2
{
public void Foobar()
{
ArrayList customerArray = new ArrayList();
customerArray.Add("Tester");
customerArray.Add("Testing");
}
}
C:\>csc /t:library z2.cs
Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.1433
for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.
C:\>
Arne