c# - How can I read the same line twice from a text file? -


i need check each line in file. if equals "eoo" break loop. if not need process line.

the problem line being skipped

while (r2.readline() != "eoo")//check {     string temp = r2.readline();     if (temp == "customer name: " + name + "") } 

what doing wrong?

save value in variable , use value saved in variable in following code:

var text = r2.readline(); // read line , save in `text`  while (text != "eoo" && !r2.endofstream) // check `eoo` or end of file {     // code, use `text` variable instead of reading next line     if (text == $"customer name: {name}")     {         ...     }      text = r2.readline(); // read next line } 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -