Created
August 19, 2018 13:39
-
-
Save jorgesanabria/6e3a760c9e071acada80bf34487d46f3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
namespace ListaStruct | |
{ | |
class Program | |
{ | |
struct A | |
{ | |
public int NumeroUno; | |
public int NumeroDos; | |
} | |
static void Main(string[] args) | |
{ | |
var lista = new List<A> | |
{ | |
new A{NumeroUno = 1, NumeroDos = 2}, new A{NumeroUno = 3, NumeroDos = 4} | |
}; | |
for (var i = 0; i < lista.Count; i++) | |
{ | |
var viejo = lista[i]; | |
lista[i] = new A { NumeroUno = viejo.NumeroUno * 2, NumeroDos = viejo.NumeroDos * 2 }; | |
} | |
lista.ForEach(x => Console.WriteLine(x.NumeroUno)); | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment