Bug in the File.ReadLines(..) method of the .net framework 4.0

后端 未结 7 1417
渐次进展
渐次进展 2021-01-11 16:31

This code :

IEnumerable lines = File.ReadLines(\"file path\");
foreach (var line in lines)
{
    Console.WriteLine(line); 
}
foreach (var line          


        
7条回答
  •  粉色の甜心
    2021-01-11 16:34

    I don't think it's a bug, and I don't think it's unusual -- in fact that's what I'd expect for something like a text file reader to do. IO is an expensive operation, so in general you want to do everything in one pass.

提交回复
热议问题