PC Review


Reply
Thread Tools Rate Thread

Determine type of serialized object

 
 
Lance
Guest
Posts: n/a
 
      2nd Oct 2003
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
 
Reply With Quote
 
 
 
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      3rd Oct 2003
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

"Lance" <(E-Mail Removed)> wrote in message
news:0fdc01c38931$9188cb90$(E-Mail Removed)...
> 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



 
Reply With Quote
 
Tian Min Huang
Guest
Posts: n/a
 
      3rd Oct 2003
Hi Lance,

I aggree with Jay's reply. In addition, I recommend you the code snippet in
the following MSDN document:

XmlDocument.Load Method
http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfSystemXmlXmlDocumentClassLoadTopic4.asp

Hope this helps.

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.

 
Reply With Quote
 
Tian Min Huang
Guest
Posts: n/a
 
      3rd Oct 2003
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Determine type of object to be pasted into document =?Utf-8?B?QXJ0?= Microsoft VB .NET 0 23rd May 2005 04:15 PM
Drag and Drop: How to determine what type of object is dropped =?Utf-8?B?bmljb21w?= Microsoft Dot NET 0 17th Jan 2005 10:29 AM
Determine Object Type Jeff S Microsoft C# .NET 9 25th Mar 2004 05:10 AM
Determine if an object is initialized and Object Type ? François Uldry Microsoft Access Form Coding 1 16th Feb 2004 12:45 PM
Determine Object Type From Database Dan Microsoft C# .NET 1 14th Oct 2003 05:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:47 AM.