gpt4 book ai didi

c# - File.OpenRead 的缓冲区大小

转载 作者:行者123 更新时间:2023-11-30 19:41:50 26 4
gpt4 key购买 nike

如果您使用 FileStream 构造函数之一,您可以以字节为单位指定缓冲区大小,但如果您使用 File.OpenRead,则不能。第二种情况中使用的缓冲区大小的默认值是多少?

最佳答案

用Telerik JustDecompile看代码,是4096 B:

public static FileStream OpenRead(string path)
{
return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
}

public FileStream(string path, FileMode mode, FileAccess access, FileShare share) : this(path, mode, access, share, 4096, FileOptions.None, Path.GetFileName(path), false)
{
}

关于c# - File.OpenRead 的缓冲区大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18657410/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com