Convert byte array To Hex - CSharp System

CSharp examples for System:Byte Array

Description

Convert byte array To Hex

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.Collections.Generic;
using System;//from   ww w  .  j a  va 2  s  . com

public class Main{
        public static string ToHex(this byte[] bytes)
        {
            string hashString = string.Empty;
            foreach (byte x in bytes)
            {
                hashString += String.Format("{0:x2}", x);
            }
            return hashString;
        }
}

Related Tutorials