Fix behavior of TextWriter.Write with null StringBuilder (#20451)
With other overloads (including Write(object)) if you passed null it just wouldn't write anything out, so we shouldn't throw for the StringBuilder overload either. Signed-off-by: dotnet-bot <dotnet-bot@microsoft.com>
This commit is contained in:
Родитель
0444608c0b
Коммит
6e9c33c283
|
@ -290,12 +290,11 @@ namespace System.IO
|
|||
/// <param name="value">The string (as a StringBuilder) to write to the stream</param>
|
||||
public virtual void Write(StringBuilder value)
|
||||
{
|
||||
if (value == null)
|
||||
if (value != null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(value));
|
||||
foreach (ReadOnlyMemory<char> chunk in value.GetChunks())
|
||||
Write(chunk);
|
||||
}
|
||||
foreach (ReadOnlyMemory<char> chunk in value.GetChunks())
|
||||
Write(chunk);
|
||||
}
|
||||
|
||||
// Writes out a formatted string. Uses the same semantics as
|
||||
|
|
Загрузка…
Ссылка в новой задаче