我正在执行以下操作:
aReader = New StreamReader(fileName)
Do Until aReader.EndOfStream
Console.WriteLine(String.Format("line {0}", aReader.ReadLine))
Loop
为了显示我在哪一行,我可以这样做:
aReader = New StreamReader(fileName)
Dim i As Integer = 0
Do Until aReader.EndOfStream
Console.WriteLine(String.Format("line {0}:{1}", i.ToString, aReader.ReadLine))
i = i + 1
Loop
文件中的每一行都有索引吗?上面是必需的,还是我可以使用或i
的内置属性?file
streamReader