When to use .NET BufferedStream class?

前端 未结 6 724
误落风尘
误落风尘 2020-12-01 05:05

The MSDN site states:

A buffer is a block of bytes in memory used to cache data, thereby reducing the number of calls to the operating system. B

6条回答
  •  忘掉有多难
    2020-12-01 05:35

    According to Brad Abrams, almost never: link

    No, there is zero benefit from wrapping a BufferedStream around a FileStream. We copied BufferedStream’s buffering logic into FileStream about 4 years ago to encourage better default performance... In fact, I don’t think there are any Streams in the .NET Framework that require it, but it might be needed by custom Stream implementations if they do not do buffering by default.

提交回复
热议问题