Convert byte array to big endian unicode string in CSharp
Description
The following code shows how to convert byte array to big endian unicode string.
Example
using System;//from ww w . j a v a 2 s . co m
using System.Text;
class StringEncodingApp {
static void Main(string[] args) {
byte[] bb = new byte[] { 0, 72, 0, 101, 0, 108, 0, 108, 0, 111 };
string t = Encoding.BigEndianUnicode.GetString(bb);
Console.WriteLine(t);
}
}
The code above generates the following result.