I have a String like this:
String data = "0x0f";
and I would like to leave it as a single byte which represents this hex. Does anyone know what function I can use?
I tried using the following function:
public byte pegarValorHexText(string text)
{
int NumberChars = text.Length;
byte[] bytes = new byte[NumberChars / 2];
for (int i = 0; i < NumberChars; i += 2)
bytes[i / 2] = Convert.ToByte(text.Substring(i, 2), 16);
return bytes[0];
}