using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;


namespace ConsoleApplication1
{
    class collectinexample
    {

        ArrayList mylist = new ArrayList();

        mylist.Add("apple");
           mylist.Add("grapes");

    }
}

this is my code but m getting an error 

"Error 1 Invalid token '(' in class, struct, or interface member declaration "
plz help

You're missing a Main method. Without getting too into detail about the nuances, any executable statements must be in a method. They won't work at the class or namespace level.

If this is for an asp.net page, as deceptikon has indicated, your code needs to be within a method such as your page load or other appropriate method.

Are you trying to port over a console app over to asp.net? Maybe you just poste this question in the wrong forum category?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.