c# - Saving an arbitrary array of bytes as a string -
i've got bunch of data need serialized string stored in kvp. i've got tons of ints, bools, , floats. take each one, bitconverter byte[] buffer.blockcopying single large byte[].
i need save large array of bytes string in keyvaluepair<string, string>. tried using encoding.ascii.getstring() big byte[] created, , tried reload level string code achieved using encoding.ascii.getbytes().
m_levelcode = encoding.ascii.getstring( bytes ); the array of bytes has tons of 0's, i'm guessing that's why m_levelcode string empty string.
is there better approach i'm trying do? have 650 bytes worth of integers, booleans, , floats. need them saved string. 1 step further, i'd comma separate 5 of these single kvp conserve on individual keys since every area has 5 levels.
there many ways convert bytes string
string base64 = convert.tobase64string(bytes); string hex = bitconverter.tostring(bytes); var jss = new javascriptserializer(); string json = jss.serialize(bytes); where bytes byte array.
Comments
Post a Comment