Hi,
i have error in line: "student.Add(info);"
Error 1 Use of unassigned local variable 'info'

public struct Students
        {
            public string Name;
            public int ID;
            public string Date;
        };

        static void Main(string[] args)
        {

            ArrayList student = new ArrayList();

            Students info;

            info.Name = "Marko";
            info.ID = 12;

            student.Add(info);

            foreach (Students show in student)
            {
                Console.WriteLine("Name:{0}, ID:{1}", show.Name, Convert.ToString(show.ID));
            }
}

Modify your Students declaration to match the following:

Students info = new Students();

Thanks

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.