简体   繁体   中英

MFC Object serialization in C#

I am trying to read a binary file in C# which has been written actually using CArchive. I have done most of the part but stuck in reading an object. Instead of writing bool, int, double object has been written into binary.

http://msdn.microsoft.com/en-us/library/3bfsbt0t(v=vs.110).aspx

So original code is something like this.

MyClass myObject;
if (archive.IsStoring()
    archive << myObject;
else
    archive >> myOjbect;

So question is how can I translate this piece of code in C#.

void Read(BinaryReader reader)
{
    // Read MyClass object here.
}

You'll need to create a comparable C# object (you might want to use C++/CLI) and construct it from the file.

It would help if you specified what myObject is.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM