I tried to find information about it and found that I can declare the list as follows:
var list= new List"object";
but I do not take well the different types of syntax I find from examples on the Internet.
How should I declare the list?
using System;
using System.Collections;
namespace TP
{
public class AltaDeProducto
{
public AltaDeProducto()
{
//EN ESTE CONSTRUCTOR DEBERIA TENER EL LIST.
}
public static ArrayList alta()
{
string respuesta = "si";
while(respuesta=="si")
{
//Declaro los objetos y comienzo con la carga de datos
Productos producto;
producto = new Productos();
Console.WriteLine("Usted eligio: Productos y Promociones"+"\n");
Console.Write("Ingrese Tipo: ");
producto.tipo = Console.ReadLine();
Console.Write("Ingrese Marca: ");
producto.marca = Console.ReadLine();
Console.Write("Ingrese Talle: ");
producto.talle = int.Parse(Console.ReadLine());
Console.Write("Ingrese Precio: ");
producto.precio = int.Parse(Console.ReadLine());
//Los agrego a la supuesta lista...
AProducto.Add(producto);
Console.Write("Cargado!"+"\n");
Console.Write("Desea ingresar otro? ");
respuesta=Console.ReadLine();
}
// Devuelvo el producto para después utilizarlo.
return AProducto;
}
}
}