假设这是我的 txt 文件:
line1
line2
line3
line4
line5
我正在阅读此文件的内容:
string line;
List<string> stdList = new List<string>();
StreamReader file = new StreamReader(myfile);
while ((line = file.ReadLine()) != null)
{
stdList.Add(line);
}
finally
{//need help here
}
现在我想读取 stdList 中的数据,但每 2 行只读取一次值(在这种情况下,我必须读取“line2”和“line4”)。谁能让我以正确的方式?