标签: c# streaming
假设我有一个对象Student s = new Student();。
Student s = new Student();
此外我有BinaryWriter bw。
如何编码和解码(在BinaryReader上)没有基本类型?
答案 0 :(得分:0)
使用Binary Serialization:
IFormatter formatter = new BinaryFormatter(); formatter.Serialize(bw.BaseStream, s);
确保您的Student类型标记为[Serializable]。
Student
[Serializable]