@@ -298,7 +298,7 @@ public virtual int Compare(string string1, string string2)
298298 return ( Compare ( string1 , string2 , CompareOptions . None ) ) ;
299299 }
300300
301- public unsafe virtual int Compare ( string string1 , string string2 , CompareOptions options )
301+ public virtual int Compare ( string string1 , string string2 , CompareOptions options )
302302 {
303303 if ( options == CompareOptions . OrdinalIgnoreCase )
304304 {
@@ -350,7 +350,7 @@ public unsafe virtual int Compare(string string1, string string2, CompareOptions
350350 // TODO https://github.com/dotnet/coreclr/issues/13827:
351351 // This method shouldn't be necessary, as we should be able to just use the overload
352352 // that takes two spans. But due to this issue, that's adding significant overhead.
353- internal unsafe int Compare ( ReadOnlySpan < char > string1 , string string2 , CompareOptions options )
353+ internal int Compare ( ReadOnlySpan < char > string1 , string string2 , CompareOptions options )
354354 {
355355 if ( options == CompareOptions . OrdinalIgnoreCase )
356356 {
@@ -390,7 +390,7 @@ internal unsafe int Compare(ReadOnlySpan<char> string1, string string2, CompareO
390390 }
391391
392392 // TODO https://github.com/dotnet/corefx/issues/21395: Expose this publicly?
393- internal unsafe virtual int Compare ( ReadOnlySpan < char > string1 , ReadOnlySpan < char > string2 , CompareOptions options )
393+ internal virtual int Compare ( ReadOnlySpan < char > string1 , ReadOnlySpan < char > string2 , CompareOptions options )
394394 {
395395 if ( options == CompareOptions . OrdinalIgnoreCase )
396396 {
@@ -436,7 +436,7 @@ internal unsafe virtual int Compare(ReadOnlySpan<char> string1, ReadOnlySpan<cha
436436 ////////////////////////////////////////////////////////////////////////
437437
438438
439- public unsafe virtual int Compare ( string string1 , int offset1 , int length1 , string string2 , int offset2 , int length2 )
439+ public virtual int Compare ( string string1 , int offset1 , int length1 , string string2 , int offset2 , int length2 )
440440 {
441441 return Compare ( string1 , offset1 , length1 , string2 , offset2 , length2 , 0 ) ;
442442 }
@@ -547,7 +547,7 @@ private static int CompareOrdinal(string string1, int offset1, int length1, stri
547547 // it assumes the strings are Ascii string till we hit non Ascii character in strA or strB and then we continue the comparison by
548548 // calling the OS.
549549 //
550- internal static unsafe int CompareOrdinalIgnoreCase ( string strA , int indexA , int lengthA , string strB , int indexB , int lengthB )
550+ internal static int CompareOrdinalIgnoreCase ( string strA , int indexA , int lengthA , string strB , int indexB , int lengthB )
551551 {
552552 Debug . Assert ( indexA + lengthA <= strA . Length ) ;
553553 Debug . Assert ( indexB + lengthB <= strB . Length ) ;
@@ -910,6 +910,18 @@ public unsafe virtual int IndexOf(string source, string value, int startIndex, i
910910 return IndexOfCore ( source , value , startIndex , count , options , null ) ;
911911 }
912912
913+ internal virtual int IndexOfOrdinal ( ReadOnlySpan < char > source , ReadOnlySpan < char > value , bool ignoreCase )
914+ {
915+ Debug . Assert ( ! _invariantMode ) ;
916+ return IndexOfOrdinalCore ( source , value , ignoreCase ) ;
917+ }
918+
919+ internal unsafe virtual int IndexOf ( ReadOnlySpan < char > source , ReadOnlySpan < char > value , CompareOptions options )
920+ {
921+ Debug . Assert ( ! _invariantMode ) ;
922+ return IndexOfCore ( source , value , options , null ) ;
923+ }
924+
913925 // The following IndexOf overload is mainly used by String.Replace. This overload assumes the parameters are already validated
914926 // and the caller is passing a valid matchLengthPtr pointer.
915927 internal unsafe int IndexOf ( string source , string value , int startIndex , int count , CompareOptions options , int * matchLengthPtr )
0 commit comments