Loops tut: Error with the foreach example

Reply Forum
Forum postGizmor @ 2010-05-13 03:49:10
ReplyReply to
Hi,

I'm following the C# tutorial and it was going well till i came to the foreach loop function.

I'm using Visual Studio 2010 Express trail to code and stuff and keeps giving 2 errors

The type or namespace 'ArrayList' could not be found

I have the following code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class program
    {
        static void Main(string[] args)
        {
            ArrayList list = new ArrayList();
            list.Add("John Doe");
            list.Add("John Doea");
            list.Add("John Doeb");

            foreach (string name in list)
                Console.WriteLine(name);

            Console.ReadLine();
        }
    }
}


Is this a function that Visual studio doesn't have anymore ?











© net-tutorials.com 2006 - 2010