0

This bit of code produces an array of size 512, it converts a string that was originally 1024 characters in length and has hex data.

byte[] content = Enumerable.Range(0, data.Length)
.Where(x => x % 2 == 0)
.Select(x => Convert.ToByte(data.Substring(x, 2), 16))
.ToArray();

I like to know how to reverse this so taking a byte[512] I want to produce the 1024 length string containing the hex data.

Sergio
  • 1,990
  • 3
  • 22
  • 40
mehwish
  • 199
  • 2
  • 14

1 Answers1

0

Try with

var result = string.Join("", 
                inputString.Select(c => String.Format("{0:X2}", Convert.ToInt32(c))));
Oscar
  • 13,056
  • 8
  • 43
  • 69