@@ -14,6 +14,24 @@ public ref partial struct ValueStringBuilder
14
14
public void AppendJoin ( ReadOnlySpan < char > separator , IEnumerable < string ? > values )
15
15
=> AppendJoinInternalString ( separator , values ) ;
16
16
17
+ /// <summary>
18
+ /// Concatenates and appends all values with the given separator between each entry at the end of the string.
19
+ /// </summary>
20
+ /// <param name="separator">String used as separator between the entries.</param>
21
+ /// <param name="values">Enumerable of strings to be concatenated.</param>
22
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
23
+ public void AppendJoin ( ReadOnlySpan < char > separator , ReadOnlySpan < string ? > values )
24
+ => AppendJoinInternalString ( separator , values ) ;
25
+
26
+ /// <summary>
27
+ /// Concatenates and appends all values with the given separator between each entry at the end of the string.
28
+ /// </summary>
29
+ /// <param name="separator">Character used as separator between the entries.</param>
30
+ /// <param name="values">Enumerable of strings to be concatenated.</param>
31
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
32
+ public void AppendJoin ( char separator , ReadOnlySpan < string ? > values )
33
+ => AppendJoinInternalChar ( separator , values ) ;
34
+
17
35
/// <summary>
18
36
/// Concatenates and appends all values with the given separator between each entry at the end of the string.
19
37
/// </summary>
@@ -42,6 +60,16 @@ public void AppendJoin(Rune separator, IEnumerable<string?> values)
42
60
public void AppendJoin < T > ( ReadOnlySpan < char > separator , IEnumerable < T > values )
43
61
=> AppendJoinInternalString ( separator , values ) ;
44
62
63
+ /// <summary>
64
+ /// Concatenates and appends all values with the given separator between each entry at the end of the string.
65
+ /// </summary>
66
+ /// <param name="separator">String used as separator between the entries.</param>
67
+ /// <param name="values">Enumerable to be concatenated.</param>
68
+ /// <typeparam name="T">Type of the given enumerable.</typeparam>
69
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
70
+ public void AppendJoin < T > ( ReadOnlySpan < char > separator , ReadOnlySpan < T > values )
71
+ => AppendJoinInternalString ( separator , values ) ;
72
+
45
73
/// <summary>
46
74
/// Concatenates and appends all values with the given separator between each entry at the end of the string.
47
75
/// </summary>
@@ -52,6 +80,16 @@ public void AppendJoin<T>(ReadOnlySpan<char> separator, IEnumerable<T> values)
52
80
public void AppendJoin < T > ( char separator , IEnumerable < T > values )
53
81
=> AppendJoinInternalChar ( separator , values ) ;
54
82
83
+ /// <summary>
84
+ /// Concatenates and appends all values with the given separator between each entry at the end of the string.
85
+ /// </summary>
86
+ /// <param name="separator">Character used as separator between the entries.</param>
87
+ /// <param name="values">Enumerable to be concatenated.</param>
88
+ /// <typeparam name="T">Type of the given enumerable.</typeparam>
89
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
90
+ public void AppendJoin < T > ( char separator , ReadOnlySpan < T > values )
91
+ => AppendJoinInternalChar ( separator , values ) ;
92
+
55
93
/// <summary>
56
94
/// Concatenates and appends all values with the given separator between each entry at the end of the string.
57
95
/// </summary>
@@ -85,6 +123,23 @@ private void AppendJoinInternalString<T>(ReadOnlySpan<char> separator, IEnumerab
85
123
}
86
124
}
87
125
126
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
127
+ private void AppendJoinInternalString < T > ( ReadOnlySpan < char > separator , ReadOnlySpan < T > values )
128
+ {
129
+ if ( values . Length == 0 )
130
+ {
131
+ return ;
132
+ }
133
+
134
+ AppendInternal ( values [ 0 ] ) ;
135
+
136
+ for ( var i = 1 ; i < values . Length ; i ++ )
137
+ {
138
+ Append ( separator ) ;
139
+ AppendInternal ( values [ i ] ) ;
140
+ }
141
+ }
142
+
88
143
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
89
144
private void AppendJoinInternalChar < T > ( char separator , IEnumerable < T > values )
90
145
{
@@ -108,6 +163,23 @@ private void AppendJoinInternalChar<T>(char separator, IEnumerable<T> values)
108
163
}
109
164
}
110
165
166
+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
167
+ private void AppendJoinInternalChar < T > ( char separator , ReadOnlySpan < T > values )
168
+ {
169
+ if ( values . Length == 0 )
170
+ {
171
+ return ;
172
+ }
173
+
174
+ AppendInternal ( values [ 0 ] ) ;
175
+
176
+ for ( var i = 1 ; i < values . Length ; i ++ )
177
+ {
178
+ Append ( separator ) ;
179
+ AppendInternal ( values [ i ] ) ;
180
+ }
181
+ }
182
+
111
183
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
112
184
private void AppendJoinInternalRune < T > ( Rune separator , IEnumerable < T > values )
113
185
{
0 commit comments