0

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!

2
  • Google. This might work, stackoverflow.com/questions/8166757/… Commented Aug 11, 2015 at 11:59
  • 1
    Neither textblock nor label show "pure decimal byte arrays". You need to convert it to string first, somehow. What are you trying to get? A list of decimal numbers separated by commas? Commented Aug 11, 2015 at 11:59

3 Answers 3

5

You can use String.Join

textBox1.Text = String.Join(",", buf);
Sign up to request clarification or add additional context in comments.

Comments

1

I imagine this would fit:

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

Regards.

1 Comment

@RonBeyer Oh, you're right, I totally forgot that. Thanks!
0

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 a c# 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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.