bytearray - Convert object to byte array in c# -


i want convert object value byte array in c#.

ex:

 step 1. input : 2200  step 2. after converting byte : 0898  step 3. take first byte(08)   output: 08 

thanks

you may take @ getbytes method:

int = 2200; byte[] bytes = bitconverter.getbytes(i); console.writeline(bytes[0].tostring("x")); console.writeline(bytes[1].tostring("x")); 

also make sure have taken endianness consideration in definition of first byte.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -