I seem to have problems with my string conversions in C #. My application received an array of bytes consisting of an ASCII string (one byte per character). Unfortunately, it also has 0 in the first place. So, how do I convert this byte array to a C # string? The following is a sample of the data I'm trying to convert:
byte[] exampleByteArray = new byte[] { 0x00, 0x52, 0x50, 0x4D, 0x20, 0x3D, 0x20, 0x32, 0x35, 0x35, 0x2C, 0x36, 0x30, 0x0A, 0x00 }; string myString = null;
I made several unsuccessful attempts, so I thought I would ask for help. In the end I need to add a line to the list:
listBox.Items.Add(myString);
Desired result in listBox: "RPM = 255,630" (with or without line feed). The byte array will be variable length, but will always end in 0x00
source share