简体   繁体   中英

display byte[] array variable in textbox (as is)

Maybe already Asked Question, but how much I look I didnt find or didnt convert how I wish. Sorry if Question repeating (please show me link if is).

I am getting some info in byte array and when debugging I see it in decimal form. How to show this byte array like it is in textblock or label?

I dont want some HEX form, just pure decimal byte array :)

Any question please ask. Thanks for help!

您可以使用String.Join

textBox1.Text = String.Join(",", buf);

I imagine this would fit:

using System.Text;
StringBuilder sb = "";
foreach (byte b in byteArray)
{
    sb.AppendLine(b);
}
Label.Text = sb.ToString();

Regards.

C# byte stores 8bits (0-255) it is shown to you as something more readable. It is not showing you a decimal number, it is showing you ac# byte, a number from 0 to 255.

references :
C# - Reading bytes, what are they and what's going on. I expect binary values, not decimal numbers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM