Vedrit
✅ Questions about casting
Hi all, I'm looking to simplify some network code I've got. Networking doesn't really play too large a role in this particular case, but it does add a level of separation between scripts sending information and scripts receiving information.
I have this one class that is used to serialize/deserialize the data for transmission. Currently, I have separate Dictionaries and counters for each data type it has to manage, so that when the data is read, I know exactly how much to cast as which type, which I do in order it was written.
My question is, do I have to use separate Dictionaries for each type, or could I use one generic Dictionary? Is there any ambiguation in the typical data types? int, string, float, etc, that would be a problem if I try to cast the data on-the-fly?
11 replies