I'm a beginner of C#, I have this class:
public Dipendente(String Id, String Nome, String Cognome, Contratto TipoContratto, DateTime Data_assunzione, double Stipendio, Dipendente Tutor)
{
this.Id = Id;
this.Nome = Nome;
this.Cognome = Cognome;
this.TipoContratto = TipoContratto;
this.DataAssunzione = Data_assunzione;
this.StipendioMensile = Stipendio;
this.Tutor = Tutor;
}
public static Dipendente GetDipendenteFromPersona(Persona persona, Contratto contratto, DateTime data_assunzione, double stipendio, Dipendente tutor)
{
Dipendente result = null;
result = new Dipendente(persona.Id, persona.Nome, persona.Cognome, contratto, data_assunzione, stipendio, tutor);
return result;
}
In the main I have a list of objects like this:
Dipendente dip1 = Dipendente.GetDipendenteFromPersona(p1, lstContratti[1], new DateTime(2000, 10, 10), 1000, null);
List<Dipendente> lstDipendenti = new List<Dipendente> {dip1, dip2, dip3, dip4, dip5, dip6, dip7, dip8};
I need to print each item in the list with his property, which is the best way to do that?
I've tried with this but obviously didn't get property values:
foreach (Dipendente dip in lstDipendenti)
{
System.Diagnostics.Debug.WriteLine(dip);
}