fork download
  1. using static System.Console;
  2. using System.Collections.Generic;
  3.  
  4. public class Program {
  5. public static void Main(string[] args) {
  6. var aluno = new List<Aluno> {
  7. new Aluno() { AlunoId = 1, Nome = "Cláudia",Email="claudia@email.com" },
  8. new Aluno() { AlunoId = 2, Nome = "Pedro",Email="pedro@email.com" },
  9. new Aluno() { AlunoId = 3, Nome = "Eduardo",Email="eduardo@email.com" }
  10. };
  11. WriteLine("==================================");
  12. foreach (var item in aluno) {
  13. WriteLine("ID: {0}\nNome: {1}\nEmail: {2}", item.AlunoId, item.Nome,item.Email);
  14. WriteLine("==================================");
  15. }
  16. aluno[0].Nome = "João";
  17. aluno[0].Email = "joao@email.com";
  18. foreach (var item in aluno) {
  19. WriteLine("ID: {0}\nNome: {1}\nEmail: {2}", item.AlunoId, item.Nome,item.Email);
  20. WriteLine("==================================");
  21. }
  22. }
  23. }
  24.  
  25. class Aluno {
  26. public int AlunoId { get; set; }
  27. public string Nome { get; set; }
  28. public string Email { get; set; }
  29. }
  30.  
  31. //https://pt.stackoverflow.com/q/87295/101
Success #stdin #stdout 0.02s 15912KB
stdin
Standard input is empty
stdout
==================================
ID: 1
Nome: Cláudia
Email: claudia@email.com
==================================
ID: 2
Nome: Pedro
Email: pedro@email.com
==================================
ID: 3
Nome: Eduardo
Email: eduardo@email.com
==================================
ID: 1
Nome: João
Email: joao@email.com
==================================
ID: 2
Nome: Pedro
Email: pedro@email.com
==================================
ID: 3
Nome: Eduardo
Email: eduardo@email.com
==================================