c# - String to HEX byte array -


i convert string hex byte array.

from "example" byte[] exampleconv = {0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65} (source: http://www.asciitohex.com/).

i search example on stackoverflow of example convert code string decimal byte array or similar. didnt find working! example convert string hex byte array (like examplehex shows above).

use encoding.default.getbytes byte array. sample code:

byte[] ba = encoding.default.getbytes("example"); // jsut display var hexstring = bitconverter.tostring(ba); console.writeline(hexstring); 

you "65-78-61-6d-70-6c-65"


Comments