File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -154,10 +154,17 @@ public void Insert(int index, string? s)
154154 Grow ( count ) ;
155155 }
156156
157+ #if NET6_0_OR_GREATE
157158 int remaining = _pos - index ;
158159 _chars . Slice ( index , remaining ) . CopyTo ( _chars . Slice ( index + count ) ) ;
159160 s . CopyTo ( _chars . Slice ( index ) ) ;
160161 _pos += count ;
162+ #else
163+ int remaining = _pos - index ;
164+ _chars . Slice ( index , remaining ) . CopyTo ( _chars . Slice ( index + count ) ) ;
165+ s . AsSpan ( ) . CopyTo ( _chars . Slice ( index ) ) ;
166+ _pos += count ;
167+ #endif
161168 }
162169
163170 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
@@ -201,7 +208,11 @@ private void AppendSlow(string s)
201208 Grow ( s . Length ) ;
202209 }
203210
211+ #if NET6_0_OR_GREATER
204212 s . CopyTo ( _chars . Slice ( pos ) ) ;
213+ #else
214+ s . AsSpan ( ) . CopyTo ( _chars . Slice ( pos ) ) ;
215+ #endif
205216 _pos += s . Length ;
206217 }
207218
You can’t perform that action at this time.
0 commit comments