Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我有一个对象Student s = new Student();。
Student s = new Student();
此外,我还有 BinaryWriter bw。
如何编码和解码(在 BinaryReader 上)非基本类型?
使用二进制序列化:
IFormatter formatter = new BinaryFormatter(); formatter.Serialize(bw.BaseStream, s);
确保您的Student类型标记为[Serializable].
Student
[Serializable]