I have this code
StreamReader productosfile;
string linea;
string[] corte = new string[6];
productosfile = File.OpenText("productos.txt");
if (File.Exists("productos.txt"))
{
do
{
linea = productosfile.ReadLine();
corte = linea.Split('|');
Producto producto = new Producto(corte[0],
Convert.ToInt32(corte[1]),
DateTime.Parse(corte[2]), Convert.ToInt32(corte[3]),
Convert.ToDecimal(corte[4]), corte[5], corte[6]);
productos.Add(producto);
} while (linea != null);
}
and I missed that error here corte = linea.Split('|')
, before I had them without the new, and look in forums and said that this error was for not instantiating the class, now that instancio because it remains pass?
note: when setting an exception control, the exception is thrown but the code does what I want, reads the txt cuts the lines instance the product class and adds it perfectly to the list. But it still bothers me that this error is still showing