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 ?


Forum posttishupan @ 2010-10-30 08:54:14
ReplyReply to
ur code is wrong...........
try this code.......
and change tutorial also...

using System;
using System.Collections;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {            
            ArrayList list = new ArrayList();
            list.Add("John Doe");
            list.Add("Jane Doe");
            list.Add("Someone Else");
            
            foreach(string name in list)
                Console.WriteLine(name);

            Console.ReadLine();
        }
    }
}


Forum postRyan @ 2011-03-25 07:19:43
ReplyReply to
Hi there,

you can get all ur queries solved @ www.projectsdeal.com

A very good platform to showcase ur project and to get any project. happy tech surfing! :)


ps: Dont hestitate to call them. i did and it helped me incredibly!


Forum postRyan @ 2011-03-25 07:30:06
ReplyReply to
Hi there,

you can get all ur queries solved @ www.projectsdeal.com

A very good platform to showcase ur project and to get any project. happy tech surfing! :)


ps: Dont hestitate to call them. i did and it helped me incredibly!











© net-tutorials.com 2006 - 2012

MailContact net-tutorials.com