@StaticRich wrote:
I have a
List<object>
which contains various different data types includingint
,float
,bool
,Rectangle
,Color
,Vector2
, andVector3
. Previously, in XNA 4.0, I was able to use anXmlSerializer
to export all of these data types to (and import them from) an XML document. Now, in MonoGame 3.0, it no longer works withRectangle
,Color
,Vector2
, orVector3
. This is the error that I get for all of them:System.InvalidOperationException: 'There was an error generating the XML document.'
Inner Exception
InvalidOperationExcetion: The type Microsoft.Xna.Framework.Rectangle was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically.I have tried putting
[XmlInclude(typeof(Rectangle))]
right above my class declaration, but this does nothing. Am I doing it wrong? Perhaps this has something to do with the fact that myList
is of the genericobject
type?
Posts: 1
Participants: 1