This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
You can't without losing data. A long needs 8 data, a char and a short 2. Therefore, you need 8 + 8 + 2*2 + 2 + 2 + 8*2 + 8*2 + 8*2 + 2 = 74 bytes. Even if you use only one byte per char (which is possible for ASCII characters) you still need 48 bytes.
You might be able to shrink those class members down via huffman encoding, that way you will lose nothing.
Your subject implies to me that you are looking to split up the serialized object into a byte array? If that is the case, I have to ask why? If I am misreading, can you clarify what you are looking to do and why please?
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: Convert Object to byte array and array size should be 40