StreamReader and seeking

后端 未结 5 468
庸人自扰
庸人自扰 2020-11-27 06:59

can you use streamreader to read a normal textfile and then in the middle of reading close the streamreader after saving the current position and then open streamreader agai

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 07:24

    From MSDN:

    StreamReader is designed for character input in a particular encoding, whereas the Stream class is designed for byte input and output. Use StreamReader for reading lines of information from a standard text file.

    In most of the examples involving StreamReader, you will see reading line by line using the ReadLine(). The Seek method comes from Stream class which is basically used to read or handle data in bytes.

提交回复
热议问题