using static System.Console;
using System.Collections.Generic;
public static void Main(string[] args) {
var alunos = new List<Aluno> {
new Aluno() { AlunoId = 1, Nome = "Cláudia", Email = "claudia@email.com" },
new Aluno() { AlunoId = 2, Nome = "Pedro", Email = "pedro@email.com" },
new Aluno() { AlunoId = 3, Nome = "Eduardo", Email = "eduardo@email.com" }
Write("Qual ID de aluno deseja modificar? (-1 para encerrar)");
if (int.TryParse(ReadLine(), out id)) {
var alunoAchado = AchaId(alunos, id);
if (alunoAchado != null) {
Write("Qual o novo nome? ");
alunoAchado.Nome = ReadLine();
Write("Qual o novo e-mail? ");
alunoAchado.Email = ReadLine();
WriteLine("Id inválido tente outro");
WriteLine("Id inválido tente outro");
static void ImprimeAlunos(List<Aluno> alunos) {
WriteLine("==================================");
foreach (var item in alunos) {
WriteLine($"ID: {item.AlunoId}\nNome: {item.Nome}\nEmail: {item.Email}");
WriteLine("==================================");
static Aluno AchaId(List<Aluno> alunos, int id) {
foreach (var item in alunos) {
if (item.AlunoId == id) {
public int AlunoId { get; set; }
public string Nome { get; set; }
public string Email { get; set; }