点击或拖拽改变大小

HslExtensionToHexString 方法 (Byte)

字节数据转化成16进制表示的字符串
Byte data into a string of 16 binary representations

命名空间:  HslCommunication
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:11.8.2.0 (11.8.2.0)
语法
public static string ToHexString(
	this byte[] InBytes
)

参数

InBytes
类型:SystemByte
字节数组

返回值

类型:String
返回的字符串

备注

在 Visual Basic 和 C# 中,这个方法可以当成为类型 的实例方法来调用。在采用实例方法语法调用这个方法时,请省略第一个参数。请参考 扩展方法 (Visual Basic)扩展方法 (C# 编程指南) 获取更多信息。
示例
ByteToHexString示例
byte[] b1 = new byte[] { 0x13, 0xA6, 0x15, 0x85, 0x5B, 0x05, 0x12, 0x36, 0xF2, 0x27 };

Console.WriteLine( SoftBasic.ByteToHexString( b1 ) );
// 输出 "13A615855B051236F227";

Console.WriteLine( SoftBasic.ByteToHexString( b1, ' ' ) );
// 输出 "13 A6 15 85 5B 05 12 36 F2 27";

Console.WriteLine( SoftBasic.ByteToHexString( b1, ' ', -1, "0x{0:X2}" ) );
// 输出 "0x13 0xA6 0x15 0x85 0x5B 0x05 0x12 0x36 0xF2 0x27";

b1.ToHexString( );
参见