0

I am trying to serialize a List which looks as follows:

public class Comp
{
    public enum TYPE {
        Type1,
        Type2,
        Type3
    };
    public Type type;

So, I create a list of these like this:

Comp a = new Comp();
a.type = Type.Type1;
Comp b = new Comp();
b.type = Type.Type2;
List<Comp> list = new List<Comp>();
list.add(a);
list.add(b);

xstream.toXML(list);

The problem is that this does not convert the enum Type in the resulting XML, it seems like it is completly ommited... Now I did some reading and it looks like EnumSingleValueConverter might somehow solve the problem - but I've got no clue how to use and all my attempts have been unsuccesful.

I was wondering if someone could help and give me an idea of how to get it to work ...
Thanks

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by peter_budo
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.