passing a arraylist to a function
Code:
using System;
using System.Collections;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int n;
Console.WriteLine("Enter the no of students");
n = int.Parse(Console.ReadLine());
ArrayList name=new ArrayList();
for(int i=0;i<n;i++)
{
Console.WriteLine("Enter the name of the "+i+"th students");
name.Add(Console.ReadLine());
}
Stu_rec(name);
Console.ReadLine();
}
static void Stu_rec(ArrayList names)
{
foreach (string n in names)
Console.WriteLine(n);
}
}
}
When i try to compile, it gives a error saying "the parameter array must be a single dimensional array"
what is the problem here.?