I'm trying to convert a string representing a hexadecimal value, for example "A0F3"
, into a hexadecimal or byte
value. I tryed to do something like this:
string text = "A0F3";
char[] chars = text.ToCharArray();
StringBuilder stringBuilder = new StringBuilder();
foreach(char c in chars)
{
stringBuilder.Append(((Int16)c).ToString("x"));
}
String textAsHex = stringBuilder.ToString();
Console.WriteLine(textAsHex);
But obviously I'm not converting the final value to a byte
value, I'm stuck.
I apprecciate your help.