473,406 Members | 2,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Determine type of serialized object

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
Nov 20 '05 #1
3 1723
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" <zi***@hotmail.com> wrote in message
news:0f****************************@phx.gbl...
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

Nov 20 '05 #2
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.

Nov 20 '05 #3
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.

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Pure Krome | last post by:
How do i serialize two instances (of some object) in the same class? I'm not sure how i would de-serialize a class that has two or more instances of some object type, and how the deserialize...
18
by: Christopher W. Douglas | last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a method that handles several events, such as closing a form and changing the visible status of a form. I have some code...
1
by: Dan | last post by:
All, I am working on an application that allows users to track various items for various clients. For example Client A may have an object Box where Client B has an object Canister. When a user...
0
by: Ray Mitchell | last post by:
Hello, The result of auto-converting some Java code to C# yielded the following upgrade issue regarding the original Java call to "reset()": public virtual void writeObj(Object obj) {...
0
by: Pierre | last post by:
Hi, I'm trying to select specific nodes from a XmlDocument filled with a serialized object and to insert these nodes into another XmlDocument. The object is well serialized (see below). From a...
2
by: RJ | last post by:
I've been trying to find documentation that explains limitation of possible types that a webmethod can return. I realize xml serialization must take place to return the specified type. Must the...
1
by: Marc | last post by:
Hi! I'm working with a C# client that calls a php web service. I've created a wrapper to call the service using .NET wsdl tool (adding a web reference). The call to the server works fine, it...
5
by: sklett | last post by:
I wasn't sure how to phrase the subject. Currently I'm storing a file as a byte in a database, when I want to work with the file I download the byte and write the data to a file on disk then...
3
by: =?Utf-8?B?UHN5cGhlcjg=?= | last post by:
I really, really want to store some settings somewhere that my control utilizes to create new object(s)(i.e., class, struct) at runtime without it knowing about the type it could create at compile...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.