I'm trying to change the name and email of a certain item from the list below, but found no way other than to remove the item from the list and add it upgraded again. Is there another way to update?
class Program
{
static void Main(string[] args)
{
List<Aluno> 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]" }
};
Console.WriteLine("==================================");
foreach (var item in aluno)
{
Console.WriteLine("ID: {0}\nNome: {1}\nEmail: {2}", item.AlunoId, item.Nome,item.Email);
Console.WriteLine("==================================");
}
Console.Read();
}
}
class Aluno
{
public int AlunoId { get; set; }
public string Nome { get; set; }
public string Email { get; set; }
}