1
- #if NET45_OR_GREATER || NETSTANDARD || NETCOREAPP2_1
1
+ #if NET45_OR_GREATER || NETSTANDARD
2
2
using System . Buffers ;
3
3
#endif
4
4
using System . Text ;
@@ -38,7 +38,7 @@ public static string UnicodeToAnsi(string value, out int byteCount)
38
38
39
39
try
40
40
{
41
- #if NET45_OR_GREATER || NETSTANDARD || NETCOREAPP2_1
41
+ #if NET45_OR_GREATER || NETSTANDARD
42
42
result = ConvertStringInternal ( utf8Encoding , ansiEncoding , value , valueLength , buffer , bufferLength ) ;
43
43
#else
44
44
utf8Encoding . GetBytes ( value , 0 , valueLength , buffer , 0 ) ;
@@ -54,7 +54,7 @@ public static string UnicodeToAnsi(string value, out int byteCount)
54
54
55
55
return result ;
56
56
}
57
- #if NET45_OR_GREATER || NETSTANDARD || NETCOREAPP2_1
57
+ #if NET45_OR_GREATER || NETSTANDARD
58
58
59
59
private static unsafe string ConvertStringInternal ( Encoding srcEncoding , Encoding dstEncoding , string s ,
60
60
int charCount , byte [ ] bytes , int byteCount )
@@ -63,7 +63,7 @@ private static unsafe string ConvertStringInternal(Encoding srcEncoding, Encodin
63
63
fixed ( byte * pBytes = bytes )
64
64
{
65
65
srcEncoding . GetBytes ( pString , charCount , pBytes , byteCount ) ;
66
- #if NET471 || NETSTANDARD || NETCOREAPP2_1
66
+ #if NET471 || NETSTANDARD
67
67
string result = dstEncoding . GetString ( pBytes , byteCount ) ;
68
68
69
69
return result ;
0 commit comments