byte To Hex Str - CSharp System

CSharp examples for System:Byte

Description

byte To Hex Str

Demo Code


using System.Xml.Serialization;
using System.Xml;
using System.Web;
using System.Text;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.InteropServices;
using System.Linq;
using System.IO;//w  w w . ja v  a  2  s.  c  o  m
using System.Collections.Generic;
using System;

public class Main{

       public static string byteToHexStr(byte[] bytes)
       {
           string returnStr = "";
           if (bytes != null)
           {
               for (int i = 0; i < bytes.Length; i++)
               {
                   returnStr += bytes[i].ToString("X2");
               }
           }
           return returnStr;
       }
}

Related Tutorials