tags:

views:

40

answers:

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,