From fe7e847050ac4d6ff83c23b800495707d1bc6c81 Mon Sep 17 00:00:00 2001 From: jontho-microsoft-com <45051489+jontho-microsoft-com@users.noreply.github.com> Date: Wed, 12 Apr 2023 15:47:58 -0700 Subject: [PATCH] Update strmreader read2.vb .NET source code clearly shows Read() may not return a fixed number of characters, but only what's currently available on the stream. ReadBlock returns the stated number of characters and only returns fewer if end of stream --- .../VS_Snippets_CLR/StrmReader Read2/VB/strmreader read2.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snippets/visualbasic/VS_Snippets_CLR/StrmReader Read2/VB/strmreader read2.vb b/snippets/visualbasic/VS_Snippets_CLR/StrmReader Read2/VB/strmreader read2.vb index 2d7b4f6ce96..6f924b4cdf1 100644 --- a/snippets/visualbasic/VS_Snippets_CLR/StrmReader Read2/VB/strmreader read2.vb +++ b/snippets/visualbasic/VS_Snippets_CLR/StrmReader Read2/VB/strmreader read2.vb @@ -24,7 +24,7 @@ Public Class Test Do While sr.Peek() >= 0 'This is an arbitrary size for this example. Dim c(5) As Char - sr.Read(c, 0, c.Length) + sr.ReadBlock(c, 0, c.Length) 'The output will look odd, because 'only five characters are read at a time. Console.WriteLine(c)