Skip to content

Commit 290b598

Browse files
committed
Hot-path for strings
1 parent 7aa9832 commit 290b598

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/LinkDotNet.StringBuilder/ValueStringBuilder.AppendJoin.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ private void AppendInternal<T>(T value)
107107
{
108108
AppendSpanFormattable(spanFormattable);
109109
}
110+
else if (value is string s)
111+
{
112+
Append(s.AsSpan());
113+
}
110114
else
111115
{
112116
Append(value?.ToString());

src/LinkDotNet.StringBuilder/ValueStringBuilder.Concat.Helper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public ref partial struct ValueStringBuilder
88
/// Concatenates multiple objects together.
99
/// </summary>
1010
/// <param name="values">Values, which will be concatenated together.</param>
11-
/// <typeparam name="T">Any given type, which can be translated to string.</typeparam>
11+
/// <typeparam name="T">Any given type, which can be translated to <see cref="string"/>.</typeparam>
1212
/// <returns>Concatenated string or an empty string if <see cref="values"/> is empty.</returns>
1313
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1414
public static string Concat<T>(params T[] values)

0 commit comments

Comments
 (0)