I have 2 foreach
nested items class, in which I go through two lists, and if the element of list 1 is found in list 2, it must do a couple of operations, the dilemma is that when dealing with very long lists, it takes a lot and I need to improve that time.
Code:
foreach (Articulo x in Articulos) //Lista Principal
{
foreach(Articulo y in listSec)
{
if (y.Art_CodGen == x.Art_CodGen) //Si son Iguales
{
if (y.Precios[0] != x.Precios[i]) //Y tienen distinto precio
{
updatedRows += UpdateArticulo(x, i); // Actualizo
}
}
}
}