I have a slightly different approach to the problem.
The file that you are trying to deserialize was created by a non .NET i.e.
non binaryformatter or even IFormatter kind of situation. Right?
ISerializable or SerializableAttribute will do you no good then.
Why?
Because these are used by the formatter, and formatters do a lot more than
"just deserialize". For example they will verify the versions,
publickeytoken .. etc. etc.
You need to create your own serialization mechanism OR if you absolutely
must insist on using ISerializable you'd have to write your own brand new
formatter.
Regards #2 - The type being deserialized is always object, you'd have to
box/unbox.
Regards #3 - No, and I am glad it isn't there as it makes no sense.
- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik [quoted text, click to view] "Nadav" <Nadav@discussions.microsoft.com> wrote in message
news:81DF76BF-C73F-4633-B4AF-CDE6FF75997F@microsoft.com...
> Hi,
>
> Introduction:
> ****************
> I am trying to DeSerialize a file that was created by an unmanaged
> application by the binary formatter, to achieve that I am implementing the
> following ISerializable methods:
> 1. GetObjectData(SerializationInfo info, StreamingContext context)
> 2. constructor(SerializationInfo info, StreamingContext context)
>
> The problem:
> ****************
> Any .NET Object has a unique identifier associated with it ( a GUID ), the
> BinaryFormatter uses this GUID to resolve the type of the object being
> DeSeriailized, When trying to DeSerialize a file that was created by a non
> .NET application this GUID is not available, thuse the BinaryFormatter
> doesn't know the serialized type and the DeSerialization fails.
>
> Questions:
> ****************
> 1. Is it possible to DeSerialize a propriotary file created by an
unmanaged
> application ( one that doesn't contain the type GUIDs ).
> 2. Is it possible to manually specify the type being deserialized.
> 3. May that be realted to the BinaryFormatter.UnsafeDeserialize API ?
> --
> Nadav
>
http://www.ddevel.com