Do I need any kind of attribute over the enum in order to serialize it
via xml? I did it and I can't see the enum in xml. Why?
Nope; it should be fine as long as the property is public. Can you
perhaps post a short (but complete) example of something that doesn't
work? The only thing that occurs is a [Flags] enum without valid
combinations for all non-trivial values... a short (but complete)
example of it working for a random attribute is shown below...
Marc
using System;
using System.IO;
using System.Xml.Serialization;
[Serializable]
public sealed class Foo
{
public TypeCode Bar { get; set; }
}
static class Program
{
static void Main()
{
using (StringWriter sw = new StringWriter())
{
Foo foo = new Foo { Bar = TypeCode.DateTime };
new XmlSerializer(typeof(Foo)).Serialize(
sw, foo);
string xml = sw.ToString();
}
}
}