Quantcast
Channel: Community | MonoGame - Latest topics
Viewing all articles
Browse latest Browse all 6821

Xml Serialization and Enums

$
0
0

@jtuttle wrote:

Hi all. Just wondering if anyone know how to correctly format enums in XML files so that the content pipeline doesn't complain when compiling them. I've created a custom class ItemInfo:

namespace CustomDataTypes {
  public enum ItemType { Edible }

  public class ItemInfo {
    public string key;
    public ItemType itemType;
  }
}

and I've been trying to set up corresponding XML like so:

<?xml version="1.0" encoding="UTF-8" ?>
<XnaContent>
  <Asset Type="CustomDataTypes.ItemInfo">
    <key>blackberry</key>
    <itemType>Edible</itemType> 
  </Asset>
</XnaContent>

This is just one of the many things I've tried and I can't find a good guide about how to do this properly, if it's even possible. Anyone know?

Thanks.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6821

Trending Articles