I don't know why my code doesn't show the students, when I try to print all the ArrayList, only shows in the console:
System.String[]
System.String[]
for example I want it to show:
Name: Roxa
Note1: 89
Note2: 78
Sorry for my bad english.
static string[] student = new string [3];
static ArrayList list = new ArrayList();
static void Main(string[] args)
{
int op = 0;
do
{
Console.WriteLine("MENU");
Console.WriteLine("1-) add student");
Console.WriteLine("2-) all students");
Console.Write("3-) SALIR");
op = int.Parse(Console.ReadLine());
Console.Clear();
switch (op)
{
case 1: addStudent(); break;
case 2: all(); break;
case 3: Console.WriteLine("---FIN DEL PROGRAMA---"); break;
case 4: Console.WriteLine("Tecla incorrecta");break;
}
} while (op != 3);
}
**
static void addStudent()
{
Console.WriteLine("Name:");
student[0] = Console.ReadLine();
Console.WriteLine("Nota1:");
student[1] = Console.ReadLine();
Console.WriteLine("Nota2:");
student[2] = Console.ReadLine();
Console.WriteLine("=======================");
list.Add(student);
Console.Clear();
}
**
static void all()
{
foreach (string[] a in list)
Console.WriteLine(a);
}