CSharp examples for System:Byte Array
Converts the byte array to a unicode string
using System;/* ww w . ja va 2s. c o m*/ public class Main{ /// <summary> /// Converts the byte array to a unicode string /// </summary> /// <param name="bytes">the bytes to convert</param> /// <returns>A string</returns> public static string ToUnicodeString(this byte[] bytes) { Check.NotNull(bytes); var chars = new char[bytes.Length / sizeof(char)]; Buffer.BlockCopy(bytes, 0, chars, 0, bytes.Length); return new string(chars); } }