Assuming that you have a
list<string>
and you want to convert all string in a list into byte array...
List<string> listaDados = new List<string>();
listaDados.Add("0x1B");
listaDados.Add("0xA2");
listaDados.Add("748");
Encoding u8 = Encoding.UTF8;
byte[] result = listaDados.SelectMany(x => u8.GetBytes(x)).ToArray();
For further details, please see:
Encoding.GetBytes Method (System.Text) | Microsoft Docs[
^]
If you would like to convert
result
into string, use this:
string s = u8.GetString(result);
Note: As Richard MacCutchan mentioned in the comment to the question, you've got wrong escape character for two hex values. I did not correct this, because i wanted to provide example how to convert list of strings into byte array.
Good luck!