C# Byte[] 字节数组转 Unicode 字符串 [英] C# Byte[] Byte array to Unicode string
本文介绍了C# Byte[] 字节数组转 Unicode 字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要从字节数组到字符串的快速转换.字节数组是Unicode字符串.
I need very fast conversion from byte array to string. Byte array is Unicode string.
推荐答案
从byte[]
数组到string
var mystring = Encoding.Unicode.GetString(myarray);
从string
到byte[]
var myarray2 = Encoding.Unicode.GetBytes(mystring);
这篇关于C# Byte[] 字节数组转 Unicode 字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文