The call to Encoding.ASCII.GetBytes
returns a byte array. You can't just convert the whole object to a string, or you get the class type (System.byte[]
in this case).
Instead, call ToString
on each item (byte) in the collection:
textBox1.Text =
string.Join(",", Encoding.ASCII.GetBytes("hello").Select(b => b.ToString()));
Output:
"104,101,108,108,111"
Or if you don't want a delimiter:
textBox1.Text = new string(
Encoding.ASCII.GetBytes("hello").SelectMany(b => b.ToString()).ToArray());
Output:
"104101108108111"