XmlSerializer.Serialize

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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 said:
Can you give a small example? Is there an error?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

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?
 
Back
Top