Possible Duplicate:
How do you convert Byte Array to Hexadecimal String, and vice versa, in C#?
I have a textbox that gets in input the string "AA 11 22 33 44 55 66 77 88 99 AA BB CC DD EE FF", i split it to have the String[], but now i have to get a byte[] like this:
byte[] b6 = new byte[20] {0xAA,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88 ,0x99 ,0xAA ,0xBB,0xCC ,0xDD ,0xEE,0xFF};
can someone suggest me how to do it. I tried to use Convert.ToByte
but I get the error of impossible to convert String
to byte.
And i don't have to convert the values in hex, only to add the 0x
in front of each byte and add to the byte array.