I created a class with 3 fields:
class Gente
{
int _ID;
string _nome, _sexo;
public Gente()
{
_ID = 0;
_nome = "";
_sexo = "";
}
public int ID
{
set { _ID = value; }
get { return _ID; }
}
public string Nome
{
set { _nome = value; }
get { return _nome; }
}
public string Sexo
{
set { _sexo = value; }
get { return _sexo; }
}
}
Then I declared a List from that class and an object from that class so that I can be able to add to the List.
List<Gente> Alunos = new List<Gente>();
Gente professor = new Gente();
The first time I do the Alunos.Add(professor); to the list it correctly sends the information to the 0 position.
But when I do it second time it overwrites everything on position 0 with the new data besides adding the new data to a new position, 1.