I have the following class
public class alumno
{
public string nombre, matricula;
public int semestre;
public string []materias = new string [5];
public double[] calif = new double[5];
}
And I need to create an array, but I run into an error when accessing it.
static void Main(string[] args)
{
alumno[] als = new alumno[5];
alumno al = new alumno(); // here i dont have problem
al.nombre = "angel"; // here i dont have problem
als[0].nombre = "angel"; // but here i DO have problem
als[0].semestre = 6;
als[0].matricula = "123";
als[0].materias[0] = "español";
als[0].calif[0] = 10;
}
The error I receive is "Referencia a objeto no establecida como instancia de un objeto", which in english means "Object reference not set to an instance of an object"
How can I fill my objects on array?