@@ -35,6 +35,8 @@ public static bool TryParse(string? target, IFormatProvider? provider, out doubl
3535 public static bool TryParse ( ReadOnlySpan < byte > target , IFormatProvider ? provider , out double result ) =>
3636#if NET8_0_OR_GREATER
3737 double . TryParse ( target , provider , out result ) ;
38+ #elif FeatureMemory && AllowUnsafeBlocks || NETCOREAPP2_1_OR_GREATER
39+ double . TryParse ( Encoding . UTF8 . GetString ( target ) , NumberStyles . Float , provider , out result ) ;
3840#else
3941 double . TryParse ( Encoding . UTF8 . GetString ( target . ToArray ( ) ) , NumberStyles . Float , provider , out result ) ;
4042#endif
@@ -68,6 +70,8 @@ public static bool TryParse(ReadOnlySpan<char> target, IFormatProvider? provider
6870 public static bool TryParse ( ReadOnlySpan < byte > target , NumberStyles style , IFormatProvider ? provider , out double result ) =>
6971#if NET8_0_OR_GREATER
7072 double . TryParse ( target , style , provider , out result ) ;
73+ #elif FeatureMemory && AllowUnsafeBlocks || NETCOREAPP2_1_OR_GREATER
74+ double . TryParse ( Encoding . UTF8 . GetString ( target ) , style , provider , out result ) ;
7175#else
7276 double . TryParse ( Encoding . UTF8 . GetString ( target . ToArray ( ) ) , style , provider , out result ) ;
7377#endif
@@ -79,6 +83,8 @@ public static bool TryParse(ReadOnlySpan<byte> target, NumberStyles style, IForm
7983 public static bool TryParse ( ReadOnlySpan < byte > target , out double result ) =>
8084#if NET8_0_OR_GREATER
8185 double . TryParse ( target , out result ) ;
86+ #elif FeatureMemory && AllowUnsafeBlocks || NETCOREAPP2_1_OR_GREATER
87+ double . TryParse ( Encoding . UTF8 . GetString ( target ) , NumberStyles . Float , null , out result ) ;
8288#else
8389 double . TryParse ( Encoding . UTF8 . GetString ( target . ToArray ( ) ) , NumberStyles . Float , null , out result ) ;
8490#endif
0 commit comments