Guest User

Untitled

a guest
Aug 19th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace ListaStruct
  5. {
  6. class Program
  7. {
  8. struct A
  9. {
  10. public int NumeroUno;
  11. public int NumeroDos;
  12. }
  13. static void Main(string[] args)
  14. {
  15. var lista = new List<A>
  16. {
  17. new A{NumeroUno = 1, NumeroDos = 2}, new A{NumeroUno = 3, NumeroDos = 4}
  18. };
  19. for (var i = 0; i < lista.Count; i++)
  20. {
  21. var viejo = lista[i];
  22. lista[i] = new A { NumeroUno = viejo.NumeroUno * 2, NumeroDos = viejo.NumeroDos * 2 };
  23. }
  24. lista.ForEach(x => Console.WriteLine(x.NumeroUno));
  25. Console.ReadKey();
  26. }
  27. }
  28. }
Add Comment
Please, Sign In to add comment