Is there a way cast an object back to it original type without specifing every case?

前端 未结 6 1375
眼角桃花
眼角桃花 2021-01-15 14:28

I have an array of different type objects and I use a BinaryWriter to convert each item to its binary equivalent so I can send the structure over the network.

I curr

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-15 15:12

    Jon's right, but I had another thought that you may find useful. Have you considered adding in another byte to the transmission of each object, then using that byte as a type code, telling you what to cast it to on the other end?

提交回复
热议问题