SKIP从平面文件中读取第150行

use*_*715 2 c# .net-3.5

我确实查找旧帖子,但这似乎没有工作.......我想基本上跳过阅读前150行....

using (StreamReader stream = new StreamReader(FileInfo.FullName)) 
{ 
    string line; 
    while(!stream.EndOfStream) 
    { 
        for (int i = 1; i >= 150; i++) 
        { 
            line = stream.ReadLine(); 
        } 
    }  
}
Run Code Online (Sandbox Code Playgroud)

谢谢,

Dar*_*g8r 5

using (StreamReader stream = new StreamReader(FileInfo.FullName)) 
{ 
    string line; 
    int i = 0;
    while(!stream.EndOfStream) 
    { 
         i++;
         line = stream.ReadLine();
         if ( i <= 150 ) continue;

         // Do something with the line. 
    }  
}
Run Code Online (Sandbox Code Playgroud)