Skip to content

Commit 59cfb1f

Browse files
committed
Use Convert.ToHexString.
1 parent 9bc4e30 commit 59cfb1f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/FirebirdSql.Data.FirebirdClient.Tests/FbDataReaderTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ public async Task ReadBinaryTest()
313313
{
314314
bytes[i] = (byte)random.Next(byte.MinValue, byte.MaxValue);
315315
}
316-
var binaryString = $"x'{BitConverter.ToString(bytes).Replace("-", string.Empty)}'";
316+
var binaryString = $"x'{Convert.ToHexString(bytes)}'";
317317

318318
await using (var command = new FbCommand($"select {binaryString} from TEST", Connection, transaction))
319319
{

src/FirebirdSql.Data.FirebirdClient/Common/Extensions.cs

+4
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,11 @@ public static IntPtr ReadIntPtr(this BinaryReader self)
4848

4949
public static string ToHexString(this byte[] b)
5050
{
51+
#if NET5_0_OR_GREATER
52+
return Convert.ToHexString(b);
53+
#else
5154
return BitConverter.ToString(b).Replace("-", string.Empty);
55+
#endif
5256
}
5357

5458
public static IEnumerable<IEnumerable<T>> Split<T>(this T[] array, int size)

0 commit comments

Comments
 (0)