Skip to content

Commit

Permalink
Use Convert.ToHexString.
Browse files Browse the repository at this point in the history
  • Loading branch information
cincuranet committed Jan 8, 2025
1 parent 9bc4e30 commit 59cfb1f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public async Task ReadBinaryTest()
{
bytes[i] = (byte)random.Next(byte.MinValue, byte.MaxValue);
}
var binaryString = $"x'{BitConverter.ToString(bytes).Replace("-", string.Empty)}'";
var binaryString = $"x'{Convert.ToHexString(bytes)}'";

await using (var command = new FbCommand($"select {binaryString} from TEST", Connection, transaction))
{
Expand Down
4 changes: 4 additions & 0 deletions src/FirebirdSql.Data.FirebirdClient/Common/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ public static IntPtr ReadIntPtr(this BinaryReader self)

public static string ToHexString(this byte[] b)
{
#if NET5_0_OR_GREATER
return Convert.ToHexString(b);
#else
return BitConverter.ToString(b).Replace("-", string.Empty);
#endif
}

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

0 comments on commit 59cfb1f

Please sign in to comment.