473,406 Members | 2,390 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.

XmlSerializer.Serialize

Hey,
I have made a method that would take any object o and an array of
extraTypes to construct a XmlSerializer object then call .Serialize(stream,
object)... When I have this called within the same method as the type it
works fine but when I am passing this type and the extra types array Its got
the subtypes but its not generating the XML.

I am passing in ob.GetType(), and xtraTypes as the constructor parameters
to XmlSerializer(..)

According to the debugger it has the type, the data and subtypes ok, its
just not serializing it to XML properely.

Is this odd behaviour of the Serializer?

Jul 21 '05 #1
2 2043
Can you give a small example? Is there an error?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<di********@discussion.microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hey,
I have made a method that would take any object o and an array of
extraTypes to construct a XmlSerializer object then call ..Serialize(stream, object)... When I have this called within the same method as the type it
works fine but when I am passing this type and the extra types array Its got the subtypes but its not generating the XML.

I am passing in ob.GetType(), and xtraTypes as the constructor parameters to XmlSerializer(..)

According to the debugger it has the type, the data and subtypes ok, its
just not serializing it to XML properely.

Is this odd behaviour of the Serializer?

Jul 21 '05 #2
There is no error reported. I just have the usual serializer call with the
object.GetType() in the first parameter and the extra types for the array of
objects , it works fine in the inline but as a generalized method its not
serializing the array of types.

I am passing in to the generaliezd one as generalSerializer(object o,
Type[] t) and passing in o.GetType(), and t[0] = someType.GetType(); I
even tried typeof(blah.blah) and same result.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:Os**************@TK2MSFTNGP12.phx.gbl...
Can you give a small example? Is there an error?

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<di********@discussion.microsoft.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hey,
I have made a method that would take any object o and an array of
extraTypes to construct a XmlSerializer object then call

.Serialize(stream,
object)... When I have this called within the same method as the type it works fine but when I am passing this type and the extra types array Its

got
the subtypes but its not generating the XML.

I am passing in ob.GetType(), and xtraTypes as the constructor

parameters
to XmlSerializer(..)

According to the debugger it has the type, the data and subtypes ok, its just not serializing it to XML properely.

Is this odd behaviour of the Serializer?


Jul 21 '05 #3

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

Similar topics

5
by: Stuart Robertson | last post by:
I am trying to find a solution that will allow me to use XmlSerializer to serialize/deserialize a collection of objects where a given object is shared between two or more other objects, and not...
2
by: Chris Aitchison | last post by:
Hello, I am attempting to have a class that I have written serialize so that it can be both passed as a parameter or return value for a webservice, and also be serialized to disk using the...
1
by: Bluetears76 | last post by:
Hi I have a hirachy of classes which are Message(base), then FileMessage and ChatMessage (extended) I want to serialize the objects and when i am deserizaling i dont know if i am getting...
3
by: Anthony Bouch | last post by:
Hi I've been reading using the XmlSerializer with custom collections. I've discovered that when serializing a custom collection (a class that implements ICollection, IList etc.) the...
4
by: Andy Neilson | last post by:
I've run across a strange behaviour with XmlSerializer that I'm unable to explain. I came across this while trying to use XmlSerializer to deserialize from a the details of a SoapException. This...
16
by: Bob Rock | last post by:
Hello, when serializing an array of elements of a class Classname using XmlSerializer.Serialize() I get an XML like the following: <?xml version="1.0"> <ArrayOfClassname> ....... ..........
2
by: magister | last post by:
Hello I got this working but it is not how I really want it, basically I have an xml file which has a root of <test> and can be filled with 3 different types of <question> elements with different...
3
by: Loui Mercieca | last post by:
Hi, I have created a class, named FormField , which basically contains two fields, name and value. I have set the tag before the class and the field is set as an XmlAttribute whil the name as...
8
by: cd~ | last post by:
I can provide a test app, the news server won't allow me to post the files because they are too large (93KB and 1.2KB) I downloaded the ESRI ArcXml schema and generated the classes from the...
2
by: Jinsong Liu | last post by:
I have following 3 classes public class MyMainClass { MyCollection<MyObject> m_oMyObjectCollection = null; private string m_sID = string.Empty; public MyCollection<MyObject> Collection {
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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.