I have to create a menu where one of its options sets the value of the attribute of a class, that class already has its objects instantiated and saved in an arraylist. The question is how do I access that attribute?
class Producto
{
public string tipo;
public double precio;
public Producto (){}
}
and so objects are added to the list:
Console.Write("¿Cuantos productos quiere dar de alta? ");
int i = int.Parse(Console.ReadLine());
Console.WriteLine("");
for( int o = 1 ; o <= i ; o++ )
{
Producto a = new Producto();
lista.Add(a);
}
What I have to do is to add certain products to a certain "discount" variable, which I then want to add to the array