Is it safe to use Stream.Seek when a BinaryReader is open?

前端 未结 3 654
长发绾君心
长发绾君心 2021-01-05 02:50

Because of the under the hood buffering strategy of BinaryReader, it is unclear to me whether is it ok or not to read an offset stored in a stream, then reposition the strea

3条回答
  •  醉酒成梦
    2021-01-05 03:24

    In my experience so long as you are using them both synchronously and no other thread is doing anything with the stream then it works perfectly fine.

    I do that extensively in applications I have written to work with binary file formats and have never encountered an issue.

提交回复
热议问题