@@ -46,7 +46,7 @@ public ValueStringBuilder(Span<char> initialBuffer)
46
46
/// </summary>
47
47
/// <param name="initialText">The initial text used to initialize this instance.</param>
48
48
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
49
- public ValueStringBuilder ( ReadOnlySpan < char > initialText )
49
+ public ValueStringBuilder ( scoped ReadOnlySpan < char > initialText )
50
50
{
51
51
Append ( initialText ) ;
52
52
}
@@ -122,7 +122,7 @@ public readonly ref char this[int index]
122
122
/// <param name="fromString">The string as initial buffer.</param>
123
123
#pragma warning disable CA2225
124
124
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
125
- public static implicit operator ValueStringBuilder( ReadOnlySpan < char > fromString ) => new ( fromString ) ;
125
+ public static implicit operator ValueStringBuilder( scoped ReadOnlySpan < char > fromString ) => new ( fromString ) ;
126
126
#pragma warning restore CA2225
127
127
128
128
/// <summary>
@@ -263,7 +263,7 @@ public void Remove(int startIndex, int length)
263
263
/// <param name="comparisonType">One of the enumeration values that specifies the rules for the search.</param>
264
264
/// <returns>The index of the found <paramref name="word"/> in this string or -1 if not found.</returns>
265
265
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
266
- public readonly int IndexOf ( ReadOnlySpan < char > word , StringComparison comparisonType = StringComparison . Ordinal ) => IndexOf ( word , 0 , comparisonType ) ;
266
+ public readonly int IndexOf ( scoped ReadOnlySpan < char > word , StringComparison comparisonType = StringComparison . Ordinal ) => IndexOf ( word , 0 , comparisonType ) ;
267
267
268
268
/// <summary>
269
269
/// Returns the index within this string of the first occurrence of the specified substring, starting at the specified index.
@@ -273,7 +273,7 @@ public void Remove(int startIndex, int length)
273
273
/// <param name="comparisonType">One of the enumeration values that specifies the rules for the search.</param>
274
274
/// <returns>The index of the found <paramref name="word"/> in this string or -1 if not found.</returns>
275
275
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
276
- public readonly int IndexOf ( ReadOnlySpan < char > word , int startIndex , StringComparison comparisonType = StringComparison . Ordinal )
276
+ public readonly int IndexOf ( scoped ReadOnlySpan < char > word , int startIndex , StringComparison comparisonType = StringComparison . Ordinal )
277
277
{
278
278
return buffer [ startIndex ..bufferPosition ] . IndexOf ( word , comparisonType ) ;
279
279
}
@@ -285,7 +285,7 @@ public readonly int IndexOf(ReadOnlySpan<char> word, int startIndex, StringCompa
285
285
/// <param name="comparisonType">One of the enumeration values that specifies the rules for the search.</param>
286
286
/// <returns>The index of the found <paramref name="word"/> in this string or -1 if not found.</returns>
287
287
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
288
- public readonly int LastIndexOf ( ReadOnlySpan < char > word , StringComparison comparisonType = StringComparison . Ordinal ) => LastIndexOf ( word , 0 , comparisonType ) ;
288
+ public readonly int LastIndexOf ( scoped ReadOnlySpan < char > word , StringComparison comparisonType = StringComparison . Ordinal ) => LastIndexOf ( word , 0 , comparisonType ) ;
289
289
290
290
/// <summary>
291
291
/// Returns the index within this string of the last occurrence of the specified substring, starting at the specified index.
@@ -295,7 +295,7 @@ public readonly int IndexOf(ReadOnlySpan<char> word, int startIndex, StringCompa
295
295
/// <param name="comparisonType">One of the enumeration values that specifies the rules for the search.</param>
296
296
/// <returns>The index of the found <paramref name="word"/> in this string or -1 if not found.</returns>
297
297
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
298
- public readonly int LastIndexOf ( ReadOnlySpan < char > word , int startIndex , StringComparison comparisonType = StringComparison . Ordinal )
298
+ public readonly int LastIndexOf ( scoped ReadOnlySpan < char > word , int startIndex , StringComparison comparisonType = StringComparison . Ordinal )
299
299
{
300
300
return buffer [ startIndex ..bufferPosition ] . LastIndexOf ( word , comparisonType ) ;
301
301
}
@@ -310,15 +310,15 @@ public readonly int LastIndexOf(ReadOnlySpan<char> word, int startIndex, StringC
310
310
/// This method performs an ordinal (case-sensitive and culture-insensitive) comparison.
311
311
/// </remarks>
312
312
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
313
- public readonly bool Contains ( ReadOnlySpan < char > word , StringComparison comparisonType = StringComparison . Ordinal ) => IndexOf ( word , comparisonType ) != - 1 ;
313
+ public readonly bool Contains ( scoped ReadOnlySpan < char > word , StringComparison comparisonType = StringComparison . Ordinal ) => IndexOf ( word , comparisonType ) != - 1 ;
314
314
315
315
/// <summary>
316
316
/// Returns whether the characters in this builder are equal to the characters in the given span.
317
317
/// </summary>
318
318
/// <param name="span">The character span to compare with the current instance.</param>
319
319
/// <returns><see langword="true"/> if the characters are equal to this instance, otherwise <see langword="false"/>.</returns>
320
320
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
321
- public readonly bool Equals ( ReadOnlySpan < char > span ) => span . Equals ( AsSpan ( ) , StringComparison . Ordinal ) ;
321
+ public readonly bool Equals ( scoped ReadOnlySpan < char > span ) => span . Equals ( AsSpan ( ) , StringComparison . Ordinal ) ;
322
322
323
323
/// <summary>
324
324
/// Returns whether the characters in this builder are equal to the characters in the given span according to the given comparison type.
@@ -327,7 +327,7 @@ public readonly int LastIndexOf(ReadOnlySpan<char> word, int startIndex, StringC
327
327
/// <param name="comparisonType">The way to compare the sequences of characters.</param>
328
328
/// <returns><see langword="true"/> if the characters are equal to this instance, otherwise <see langword="false"/>.</returns>
329
329
[ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
330
- public readonly bool Equals ( ReadOnlySpan < char > span , StringComparison comparisonType ) => span . Equals ( AsSpan ( ) , comparisonType ) ;
330
+ public readonly bool Equals ( scoped ReadOnlySpan < char > span , StringComparison comparisonType ) => span . Equals ( AsSpan ( ) , comparisonType ) ;
331
331
332
332
/// <summary>
333
333
/// Disposes the instance and returns the rented buffer to the array pool if needed.
0 commit comments