I have a list declared as:
List<byte> localData = new List<byte>();
The list contains: AA 01 53 54 41 43 4B 20 4F 56 45 52 46 4C 4F 57 34 5C
, where from localData[2]
to localData[15]
i have the text STACK OVERFLOW
, that i will output to a textBox.
I cannot find a converter to do this for me, therefore i used a table do convert it in this way:
//Here i have all printable ascii chars.
char[] asciiTable = {' ','!','"','#','$','%','&','\'','(',')'etc... };
To print the data out i used:
textBox1.Clear();
for (i = 2; i < 16; i++)
{
textBox1.Text += asciiTable[localData[i] - 32];
}
But i think there must be a better conversion method. Note: I'm using Visual Studio 2015 Express for Desktop.
Edit: The suggested duplicate How to convert byte[] to string? does not cover the use of List.