@@ -81,14 +81,14 @@ public ValueStringBuilder(ReadOnlySpan<char> initialText)
8181 /// </summary>
8282 /// <returns>The <see cref="string"/> instance.</returns>
8383 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
84- public override string ToString ( ) => new ( buffer [ ..bufferPosition ] ) ;
84+ public readonly override string ToString ( ) => new ( buffer [ ..bufferPosition ] ) ;
8585
8686 /// <summary>
8787 /// Returns the string as an <see cref="ReadOnlySpan{T}"/>.
8888 /// </summary>
8989 /// <returns>The filled array as <see cref="ReadOnlySpan{T}"/>.</returns>
9090 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
91- public ReadOnlySpan < char > AsSpan ( ) => buffer [ ..bufferPosition ] ;
91+ public readonly ReadOnlySpan < char > AsSpan ( ) => buffer [ ..bufferPosition ] ;
9292
9393 /// <summary>
9494 /// Get a pinnable reference to the represented string from this builder.
@@ -112,7 +112,7 @@ public ValueStringBuilder(ReadOnlySpan<char> initialText)
112112 /// <param name="destination">The destination where the internal string is copied into.</param>
113113 /// <returns>True, if the copy was successful, otherwise false.</returns>
114114 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
115- public bool TryCopyTo ( Span < char > destination ) => buffer [ ..bufferPosition ] . TryCopyTo ( destination ) ;
115+ public readonly bool TryCopyTo ( Span < char > destination ) => buffer [ ..bufferPosition ] . TryCopyTo ( destination ) ;
116116
117117 /// <summary>
118118 /// Clears the internal representation of the string.
@@ -189,7 +189,7 @@ public void Remove(int startIndex, int length)
189189 /// <param name="word">Word to look for in this string.</param>
190190 /// <returns>The index of the found <paramref name="word"/> in this string or -1 if not found.</returns>
191191 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
192- public int IndexOf ( ReadOnlySpan < char > word ) => IndexOf ( word , 0 ) ;
192+ public readonly int IndexOf ( ReadOnlySpan < char > word ) => IndexOf ( word , 0 ) ;
193193
194194 /// <summary>
195195 /// Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
@@ -198,7 +198,7 @@ public void Remove(int startIndex, int length)
198198 /// <param name="startIndex">Index to begin with.</param>
199199 /// <returns>The index of the found <paramref name="word"/> in this string or -1 if not found.</returns>
200200 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
201- public int IndexOf ( ReadOnlySpan < char > word , int startIndex )
201+ public readonly int IndexOf ( ReadOnlySpan < char > word , int startIndex )
202202 {
203203 if ( startIndex < 0 )
204204 {
@@ -219,7 +219,7 @@ public int IndexOf(ReadOnlySpan<char> word, int startIndex)
219219 /// <param name="word">Word to look for in this string.</param>
220220 /// <returns>The index of the found <paramref name="word"/> in this string or -1 if not found.</returns>
221221 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
222- public int LastIndexOf ( ReadOnlySpan < char > word ) => LastIndexOf ( word , 0 ) ;
222+ public readonly int LastIndexOf ( ReadOnlySpan < char > word ) => LastIndexOf ( word , 0 ) ;
223223
224224 /// <summary>
225225 /// Returns the index within this string of the last occurrence of the specified substring, starting at the specified index.
@@ -228,7 +228,7 @@ public int IndexOf(ReadOnlySpan<char> word, int startIndex)
228228 /// <param name="startIndex">Index to begin with.</param>
229229 /// <returns>The index of the found <paramref name="word"/> in this string or -1 if not found.</returns>
230230 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
231- public int LastIndexOf ( ReadOnlySpan < char > word , int startIndex )
231+ public readonly int LastIndexOf ( ReadOnlySpan < char > word , int startIndex )
232232 {
233233 if ( startIndex < 0 )
234234 {
@@ -252,13 +252,13 @@ public int LastIndexOf(ReadOnlySpan<char> word, int startIndex)
252252 /// This method performs an ordinal (case-sensitive and culture-insensitive) comparison.
253253 /// </remarks>
254254 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
255- public bool Contains ( ReadOnlySpan < char > word ) => IndexOf ( word ) != - 1 ;
255+ public readonly bool Contains ( ReadOnlySpan < char > word ) => IndexOf ( word ) != - 1 ;
256256
257257 /// <summary>
258258 /// Disposes the instance and returns rented buffer from an array pool if needed.
259259 /// </summary>
260260 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
261- public void Dispose ( )
261+ public readonly void Dispose ( )
262262 {
263263 if ( arrayFromPool != null )
264264 {
0 commit comments