C# 将字节数组转换字符串示例
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication15 { class Program { static void Main(string[] args) { byte[] value = { 0x02, 0xAB, 0xC1, 0xCD, 0x12, 0xDE }; string str1 = BitConverter.ToString(value); Console.WriteLine(str1); str1 = BitConverter.ToString(value).Replace("-", ""); Console.WriteLine(str1); Console.ReadLine(); } } }
C# 如何将字节数组转换为字符串值?
我们将使用System.BitConverter类,该类将基本数据类型转换为字节数组和VISE和VERSA。
它具有一个方法,其中一个是ToString(字节[]),它将指定数组数组的每个元素的数值转换为其对应的字符串表示。
日期:2020-04-11 22:50:19 来源:oir作者:oir