Skip to content

Commit 86b48d7

Browse files
authored
Fix IUtf8SpanFormattable.TryFormat argument name (#84535)
The approved parameter name was `utf8Destination` rather than just `destination`.
1 parent ef1ba77 commit 86b48d7

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/libraries/System.Private.CoreLib/src/System/IUtf8SpanFormattable.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ namespace System
77
public interface IUtf8SpanFormattable
88
{
99
/// <summary>Tries to format the value of the current instance as UTF8 into the provided span of bytes.</summary>
10-
/// <param name="destination">When this method returns, this instance's value formatted as a span of bytes.</param>
11-
/// <param name="bytesWritten">When this method returns, the number of bytes that were written in <paramref name="destination"/>.</param>
12-
/// <param name="format">A span containing the characters that represent a standard or custom format string that defines the acceptable format for <paramref name="destination"/>.</param>
13-
/// <param name="provider">An optional object that supplies culture-specific formatting information for <paramref name="destination"/>.</param>
10+
/// <param name="utf8Destination">When this method returns, this instance's value formatted as a span of bytes.</param>
11+
/// <param name="bytesWritten">When this method returns, the number of bytes that were written in <paramref name="utf8Destination"/>.</param>
12+
/// <param name="format">A span containing the characters that represent a standard or custom format string that defines the acceptable format for <paramref name="utf8Destination"/>.</param>
13+
/// <param name="provider">An optional object that supplies culture-specific formatting information for <paramref name="utf8Destination"/>.</param>
1414
/// <returns><see langword="true"/> if the formatting was successful; otherwise, <see langword="false"/>.</returns>
1515
/// <remarks>
1616
/// An implementation of this interface should produce the same string of characters as an implementation of <see cref="IFormattable.ToString"/> or <see cref="ISpanFormattable.TryFormat"/>
1717
/// on the same type. TryFormat should return false only if there is not enough space in the destination buffer; any other failures should throw an exception.
1818
/// </remarks>
19-
bool TryFormat(Span<byte> destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider? provider);
19+
bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider? provider);
2020
}
2121
}

src/libraries/System.Runtime/ref/System.Runtime.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3871,7 +3871,7 @@ public partial interface ISpanParsable<TSelf> : System.IParsable<TSelf> where TS
38713871
}
38723872
public partial interface IUtf8SpanFormattable
38733873
{
3874-
bool TryFormat(System.Span<byte> destination, out int bytesWritten, System.ReadOnlySpan<char> format, System.IFormatProvider? provider);
3874+
bool TryFormat(System.Span<byte> utf8Destination, out int bytesWritten, System.ReadOnlySpan<char> format, System.IFormatProvider? provider);
38753875
}
38763876
public partial class Lazy<[System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembersAttribute(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]T>
38773877
{

src/libraries/System.Runtime/tests/System/Text/Unicode/Utf8Tests.TryWrite.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,14 +584,14 @@ public Utf8SpanFormattableInt32Wrapper(int value)
584584
_value = value;
585585
}
586586

587-
public bool TryFormat(Span<byte> destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider provider)
587+
public bool TryFormat(Span<byte> utf8Destination, out int bytesWritten, ReadOnlySpan<char> format, IFormatProvider provider)
588588
{
589589
ToStringState.LastFormat = format.ToString();
590590
ToStringState.LastProvider = provider;
591591
ToStringState.ToStringMode = ToStringMode.ISpanFormattableTryFormat;
592592

593593
ReadOnlySpan<byte> src = Encoding.UTF8.GetBytes(_value.ToString(format.ToString(), provider)).AsSpan();
594-
if (src.TryCopyTo(destination))
594+
if (src.TryCopyTo(utf8Destination))
595595
{
596596
bytesWritten = src.Length;
597597
return true;

0 commit comments

Comments
 (0)