Bin To String - CSharp System

CSharp examples for System:Byte

Description

Bin To String

Demo Code


using System.Reflection;
using System.Globalization;
using System;//from w  w w.j  a va 2 s .c om

public class Main{
        private static string BinToString(byte[] rg)
      {
         if (rg != null)
         {
            string str = "";
            for (int i = 0; i < rg.GetLength(0); i++)
            {
               str = string.Concat(str, string.Format("{0:x2}", rg[i]));
            }
            return str;
         }
         else
         {
            return "";
         }
      }
}

Related Tutorials