byte array To Hex - CSharp System

CSharp examples for System:Byte Array

Description

byte array To Hex

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.IO;/*  ww w . ja  v a 2 s. co m*/
using System.Drawing;
using System.Collections.Generic;
using System;

public class Main{
        public static string ToHex(this byte[] raw)
        {
            StringBuilder hex = new StringBuilder(raw.Length * 2);
            foreach (byte b in raw)
            {
                hex.AppendFormat("{0:x2} ", b);
            }

            return hex.ToString().Trim().ToUpper();
        }
}

Related Tutorials