I've got a bunch of data that I need serialized into a string to be stored in a KVP. I've got tons of ints, bools, and floats. I take each one, BitConverter it into a byte[] that I am Buffer.BlockCopying into a single large byte[].
I need to save this large array of bytes as a string in a KeyValuePair<string, string>. I tried using Encoding.ASCII.GetString() with the big byte[] I created, and then I tried to reload my level with the string code achieved using Encoding.ASCII.GetBytes().
m_LevelCode = Encoding.ASCII.GetString( bytes );
The array of bytes has tons of 0's, so I'm guessing that's why my m_LevelCode string is an empty string.
Is there a better approach to what I'm trying to do? I have about 650 bytes worth of integers, booleans, and floats. I need them to be saved into a string. One step further, I'd like to comma separate 5 of these into a single KVP to conserve on individual keys since every area has 5 levels.
m_LevelCodeshould be the same asbytesbecause UTF-16 encodes any character that ASCII can provide as one code unit (char).