Herby... Having written in C++/cli for one week, I can confidently say :)
You could write a bridge class that implements a custom interface say IData.
Provide a method that converts your unmanaged data to managed data and wraps
them in a concrete class MyData of type IData, marked [Serializable]. Write a
IVersion and IData interface and compile this into a pure MSIL
MyInterface.dll. In your mixed C++/cli application reference the dll as using
"MyInterface.dll". In your mixed mode class provide a method ToManagedData
that takes an unmanaged data object and returns an instance of your managed
MyData class. Create a concrete class MyVersion of type IVersion. Use
binaryformatter to serialize MyVersion and then MyData to a file. Then in a
C# class open the file, deserialize the MyVersion object, check for the
correct version and then deserialize the MyData object.
Of course, it would be a lot easier if STL.NET emits classes that are marked
[Serializable], but then since I cannot download it yet, I cannot say.
"Herby" wrote:
Tom.
I need to serialize from a current un-managed application
I then want to de-serialize this into a new managed application.
This serialized file is then the bridge between the old un-managed
application and the new managed application.
We want the new managed application to be backward portable to C++\STL(
as much as possible) consequently this is why we are writing the new
application in C++\CLI and STL\CLR.
The new application must be 100% verifiable.
We will only use .NET specifics ( framework classes ) where these is no
viable compatible C++\STL solution.
Performance is also critical in terms of loading these files and the
space they take up on disk.
So it seems to me now i will write a custom serialize mechanism in the
source un-managed application.
So i cannot use the inbuilt .NET serialization mechanism because it
will not understand my serialized file format.
And then write a custom de-serialize mechanism in the new application.
The IOStream classes are not going to be ported to STL\CLR.
So here it would seem i am forced to use .NET to de-serialize my
file????
What class should i use?
Thanks.