我必须将对象写入二进制文件。我的结构如下所示。
Struct Company
{
int numberofemployees
list of Struct Employee.
}
Struct Employee
{
string EmployeeName;
string Designation;
}
执行上述操作的最佳方法是什么? 问候 拉朱
最佳答案
据我了解,BinaryFormatter是这项工作的工具。
编辑:正如 Marc 在评论中解释的那样,BinaryFormatter 有一些缺点。他推荐protobuf-net在他的博客中。
关于C# 将对象写入二进制文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2598929/