public double GetTotal() { var total = 0.0; int i = 0; foreach (var producto in Productos) { total += producto.Precio * CantidadDeProducto.Get(i).IntValue; i++; } return(total); }
public void AddProducto(Producto producto, int cantidad) { int i = 0; foreach (var p in Productos) { if (p.Equals(producto)) { CantidadDeProducto.Get(i).IntValue += cantidad; return; } i++; } Productos.AddLast(producto); CantidadDeProducto.AddLast(new IntWrapper(cantidad)); }