Home › Forums › Support › Serializing Objects › Reply To: Serializing Objects
Thank you very much. #4 gave me the break through – I did not know that it was possible to serialize / deserialize using your code from byte[] to an object, and that allowed me to define what kind of data “data” is (array of bytes) and thus avoid errors related to not defining what kind of object it is.
The reason why I use the same string for different packets, is because I have a class called PacketHeader. So when I do myConnection.SendObject(“PacketHeader”, packet) – the other side knows it uses the packetHeader class with byte[] data. Then depending on the packet type (as defined in the header), I can further deserialize the data into another packet.
But I’m also using stringSendingPacketType for other packets too. Like authentication against the server – that only the server will get (not get and forward like with PacketHeader packets) I would use “ReportModuleStatistics” or something similar.
Thank you once again for your help. Great work on the code. =-)