write struct data to binary file

5Yr*_*DBA 4 c#

I received some data (many times) which are encapsulated inside a struct. what I need to do is write them to a file (binary) to restore the data. how will you do it?

All*_*enG 6

实现ISerializable(更大的自定义)或使用[Serializable]属性标记(更易于使用).然后使用a BinaryFormatter序列化到文件.