Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

C#: Encoder les données binaires en Base64

            if ((byteLength % 4) != 0)
            {
 
                byteLength += 4 - (byteLength % 4);
            }
 
            char[] encodedCharArray = new char[byteLength];
            Convert.ToBase64CharArray(sourceBytes, 0, sourceBytes.Length, encodedCharArray, 0);

C#: Convertir un tableau d’octet UTF-16 en String

        public static string UTF16ByteArrayToString(byte[] characters)
        {
            UnicodeEncoding encoding = new UnicodeEncoding();
            string resultString = encoding.GetString(characters);
 
            return (resultString);
        }

C#: Convertir un tableau d’octet en String

        public static string ByteArrayToString(byte[] characters)
        {
            ASCIIEncoding encoding = new ASCIIEncoding();
            string resultString = encoding.GetString(characters);