using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication6
{
class Program
{
static void Main(string[] args)
{
string[] message = new string[2]{ "你好","hello"} ;
byte[] data=new byte[message.Length];
for (int i = 0; i < message.Length; i++)
{
data[i]=Convert.ToByte(Convert.ToInt32(message[i]));
}
foreach (byte b in data)
{
Console.WriteLine(b.ToString("X2")+" "); //法1
}
//Console.WriteLine(BitConverter.ToString(data));//法2
Console.ReadLine();
}
}
}
C#在控制台应用程序中显示输出字节型数据
猜你喜欢
转载自blog.csdn.net/qq_36545099/article/details/68961915
今日推荐
周排行