CSharp · Console
using static System.Console;
using System.Collections.Generic;
public class Program {
public static void Main(string[] args) {
var aluno = new List<Aluno> {
new Aluno() { AlunoId = 1, Nome = "Cláudia",Email="[email protected]" },
new Aluno() { AlunoId = 2, Nome = "Pedro",Email="[email protected]" },
new Aluno() { AlunoId = 3, Nome = "Eduardo",Email="[email protected]" }
};
WriteLine("==================================");
foreach (var item in aluno) {
WriteLine("ID: {0}\nNome: {1}\nEmail: {2}", item.AlunoId, item.Nome,item.Email);
WriteLine("==================================");
}
aluno[0].Nome = "João";
aluno[0].Email = "[email protected]";
foreach (var item in aluno) {
WriteLine("ID: {0}\nNome: {1}\nEmail: {2}", item.AlunoId, item.Nome,item.Email);
WriteLine("==================================");
}
}
}
class Aluno {
public int AlunoId { get; set; }
public string Nome { get; set; }
public string Email { get; set; }
}