Monogame: Why no [Serializable] ?

Created on 7 Jan 2017  路  8Comments  路  Source: MonoGame/MonoGame

Hello friends,
why are structs like vector, vertexpositiontexture et cetera not marked as serializable?
It would be a great help.. espacially when saving exempli gratia vertex-chunks or something as bytes.

Is there a possiblity to "fix" it or do I need to recreate these structs marked as serializable?

Best regards,
net-d3v3l0p3r ( =

Most helpful comment

The [Serializable] attribute is not available on all platforms, i.e. WinRT.
Check the history on this source files.

All 8 comments

They're serializable in XNA, so I guess this was just overlooked. This should get implemented :) It's just a matter of adding the attribute.

yeah, one time I needed this so I had to edit the monogame source, a little annoying but also kind of fun. it would be nice if someone added this for real.

@NET-D3v3l0p3r @kameko If either of you would like to do this that would be very much appreciated :)

Done, as you said.. a few changes.. thank You ( =

The [Serializable] attribute is not available on all platforms, i.e. WinRT.
Check the history on this source files.

Ah, so the alternative that was used is the DataContractAttribute which also makes the type serializable.

I don't think DataContract is a direct replacement though. It may not work
exactly the same. But Serializable is not available on all platforms, so
that can't be expected to work the same either.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Ellesent picture Ellesent  路  5Comments

MontyHimself picture MontyHimself  路  5Comments

dazinator picture dazinator  路  5Comments

NET-D3v3l0p3r picture NET-D3v3l0p3r  路  3Comments

tomspilman picture tomspilman  路  4Comments