Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我经常看到到处都使用 4096 作为默认缓冲区大小。有什么理由选择 4096 而不是另一个值?
这实际上取决于您的问题,但该问题的一般折衷解决方案是 4KB。您可以在下面列出的链接下找到此选择的一个很好的描述:
带有流的文件 I/O - 最佳内存缓冲区大小
http://social.msdn.microsoft.com/Forums/en-US/ed3c6dea-400e-489c-9a86-b43b3a78cc1c/quick-question-about-filestream-buffering?forum=csharpgeneral
C# FileStream:写入大文件的最佳缓冲区大小?