473,320 Members | 1,744 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,320 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?

Nov 15 '05 #1
2 2029
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?

Nov 15 '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?


Nov 15 '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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.