C#扩展方法实现 byte[] 输出为HEX字符串形式
public static class Util
{
public static string ToHexString(this byte[] bytes)
{
string byteStr = string.Empty;
if (bytes != null || bytes.Length > 0)
{
foreach (var item in bytes)
{
byteStr += string.Format("{0:X2} ", item);
}
}
return byteStr;
}
}
posted on 2015-12-17 13:53 HOT SUMMER 阅读(5309) 评论(0) 编辑 收藏 举报