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
  • 2,078
  • 3
  • 24
  • 41
mehwish
  • 199
  • 3
  • 15

1 Answers1

0

Try with

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