Efficient small byte-arrays in C#
问题 I have a huge collection of very small objects. To ensure the data is stored very compactly I rewrote the class to store all information within a byte-array with variable-byte encoding. Most instances of these millions of objects need only 3 to 7 bytes to store all the data . After memory-profiling I found out that these byte-arrays always take at least 32 bytes . Is there a way to store the information more compactly than bit-fiddled into a byte[]? Would it be better to point to an unmanaged