Determine type of serialized object

L

Lance

Is there any way to determine the type of an object that
is stored as a serialized file without deserializing the
entire file? If possible, I'm interested in being able to
do this for both binary and XML files.

Thanks,
Lance
 
J

Jay B. Harlow [MVP - Outlook]

Lance,
For XML files it should be relatively easy, as you can physically see the
format, and you could load the XML file into an XMLDocument or XPathDocument
and extract the type.

Unfortunately for binary serialization I do not believe the binary file
format is documented, so you will need to deserialize the file to find the
type.

Hope this helps
Jay
 
T

Tian Min Huang

Hi Lance,

On more thing you should keep in mind is that XML serialization serializes
only public properties and fields and does not preserve type fidelity.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top