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
Post a Comment