Convert byte array To Hex String via List - CSharp System

CSharp examples for System:Byte Array

Description

Convert byte array To Hex String via List

Demo Code

// Copyright (c) Microsoft Corporation. All rights reserved. 
using System.Text;
using System.Linq;

public class Main{
    public static string ToHexString(this byte[] data)
      {//w ww.j  av a 2  s . co  m
         var builder = new StringBuilder(data.Length * 2);
         data.ToList().ForEach(x => builder.Append(x.ToString("X2")));
         return builder.ToString();
      }
}

Related Tutorials