I have a uint value that I need to represent as ByteArray and convert to a string. When I convert a string to an array of bytes, I found different values. I use the standard ASCII converter, so I donβt understand why I have different values. To be more clear, this is what I am doing:
byte[] bArray = BitConverter.GetBytes((uint)49694); string test = System.Text.Encoding.ASCII.GetString(bArray); byte[] result = Encoding.ASCII.GetBytes(test);
The result of bytearray is different from the first:
bArray β
[0x00000000]: 0x1e [0x00000001]: 0xc2 [0x00000002]: 0x00 [0x00000003]: 0x00
result β
[0x00000000]: 0x1e [0x00000001]: 0x3f [0x00000002]: 0x00 [0x00000003]: 0x00
Note that byte 1 is different in two arrays.
Thanks for your support.
Hello
source share