I'm trying to go through a txt file with StreamReader , the problem I have is that I can never get past the first row of my txt file and I do not understand why.
I have dealt with a for and with a while but I only cycle on the first row infinitely.
var file = Request.Files[0]; //
string content = new StreamReader(file.InputStream).ReadToEnd();
using (var reader = new StreamReader(content))
{
while (reader.Peek() >= 0)
{
var linea = reader.ReadLine();
var a = linea.Substring(0, linea.IndexOf("\n", 0));
Extraer(a);
}
}
Could someone tell me what I'm doing wrong or how best is my method?