StreamReader的默认值是什么? [英] What are the default values for StreamReader?
问题描述
我需要使用此构造函数 public StreamReader(流流,编码编码,bool detectEncodingFromByteOrderMarks,int bufferSize,bool LeaveOpen)
来设置如果您使用 LeaveOpen
到 true
。为了做到这一点,我还需要设置其他参数( Encoding encoding,bool detectEncodingFromByteOrderMarks,int bufferSize
)。我想直接使用 StreamReader
,所以我不想提供一些随机值。这些参数的默认值是什么?
I need to use this constructor public StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize, bool leaveOpen)
in order to set leaveOpen
to true
. And in order to do that I need to set the other parameters as well (Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize
). I want to use StreamReader
as it is so I do not want to give some random values. What are the default values for these parameters?
顺便说一句,我知道我可以使用 StreamReader
而不使用使用
。
By the way, I know that I can use StreamReader
without using
. And GC will get rid of it without touching the stream.
推荐答案
默认值如下:
- 编码:Encoding.UTF8
- detectEncodingFromByteOrderMarks:true
- DefaultBufferSize:1024
您可以通过访问参考源
这篇关于StreamReader的默认值是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!