StreamReader default and minimum buffer size

StewartBW 1,145 Reputation points
2024-08-16T09:16:11.0033333+00:00

Hello

StreamReader(Stream, Encoding, detectEncodingFromByteOrderMarks, bufferSize)

Anyone knows in VB.net under .net framework 4.0 full for WinForms, what's the default and minimum buffer size (in integer) of the above StreamReader Constructor?

Thanks for advise.

VB
VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,715 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Dewayne Basnett 1,361 Reputation points
    2024-08-16T13:35:04.42+00:00
    0 comments No comments

  2. Jiachen Li-MSFT 31,011 Reputation points Microsoft Vendor
    2024-08-19T06:28:16.3366667+00:00

    Hi @StewartBW ,

    In VB.NET under .NET Framework 4.0 for WinForms, the StreamReader constructor has a default buffer size of 1,024 bytes (which is 1 KB).

    The minimum buffer size you can specify for the StreamReader constructor is 128 bytes.

    Best Regards.

    Jiachen Li


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.