问题描述
如何从文件中读取一行?当我想写文件时,只需创建FileStream和FileWriter并写一行.但是,如果我想阅读一些特定的行怎么办?我注意到FileReader也存在,但没有发现如何使用它.
对于这样的菜鸟问题,我很抱歉,我仅几天就学习C#.感谢您的帮助.
好吧,它应该看起来像str = streamReader.ReadLine();.但是如何指定要阅读的行?找不到如何使用ReadLine和msdn的解释是不好的:(
Hi,
How to read one line from file? When I want to write to file its simply I just create FileStream and FileWriter and write line. But what if I want to read some specific line? I''ve noticed that FileReader exists too but didn''t found nowhere how to use it.
I''am sorry for such noob question I''am learning C# just few days. Thanks for any help.
Well so it should look like str = streamReader.ReadLine(); but how can I specify what line I want to read? Can''t find how to use ReadLine and msdn explanation is bad :(
推荐答案
这篇关于读取文件中的特定行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!