MapState not serializable?
Issue #10
new
I was trying to save the map using MapState and serialization, because it says that MapState is "easily serialized and deserialized," however I just get the exception saying that RogueSharp.MapState is not marked serializable. I tried marking it with the [Serializable] tag but that did nothing, so I was wondering what I was missing?
Comments (1)
-
repo owner - Log in to comment
The [Serializable] attribute was not part of .NET Core and it's not important unless you are trying to use the BinaryFormatter. See https://stackoverflow.com/questions/39199049/what-is-the-equivalent-of-serializable-in-net-core-conversion-projects for more details.
Depending on what format you want to serialize to, I'd recommend using JSON.NET or ServiceStack.Text https://github.com/ServiceStack/ServiceStack.Text
If you don't want to add a dependency like that you can still serialize to XML. One example is here -> https://support.microsoft.com/en-us/help/815813/how-to-serialize-an-object-to-xml-by-using-visual-c but you'll find lots more out there.
Hope this helps. If not, please post a link to the source and I'll take a look at it.