使用streamreader,如果行以'0'開始跳過行???如何在流讀取器中跳過一行?
string FileToProcess = System.IO.File.ReadAllText(@"up.FolderPath");
using (StreamReader sr = new StreamReader(FileToProcess))
{
while (!sr.EndOfStream)
{
string line = sr.ReadLine();
if (line.StartsWith("0"))
{
line.Skip();
// ????have to put a number line in here
// But i just want to skip the line it is on
}
}
}
爲什麼不直接否定if? 'if(!line.StartsWith(「0」)){//用你所關心的行做東西}' – CodingIntrigue
因爲我有其他的條件,想請教如何跳過當前行 – John
創建一個int值? – John