Skip to content

Commit 5eb4cc9

Browse files
committed
feat: 增加重载方法
1 parent 0f43203 commit 5eb4cc9

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/extensions/BootstrapBlazor.Socket/DataConverter/HexConverter.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,16 @@ public static string ToString(byte[]? bytes, string? separator = "-", bool upper
3232
return string.Join(separator, bytes.Select(i => upper ? i.ToString("X2") : i.ToString("x2")));
3333
}
3434

35+
/// <summary>
36+
/// 将 byte[] 转为 16 进制字符串
37+
/// <para>Converts a byte array to its hexadecimal string representation.</para>
38+
/// </summary>
39+
/// <param name="span"></param>
40+
/// <param name="separator"></param>
41+
/// <param name="upper"></param>
42+
/// <returns></returns>
43+
public static string ToString(ReadOnlySpan<byte> span, string? separator = "-", bool upper = true) => ToString(span.ToArray(), separator, upper);
44+
3545
/// <summary>
3646
/// 将字符串转换为字节数组
3747
/// </summary>

0 commit comments

Comments
 (0)