XmlSerializer - some (enum) field not getting serialized...?
Here's the scenario. I'm serializing a particular object, which contains other objects as properties. I have this particular enum type that won't get included in the serialized XML.
For illustration - I'll simplify the class (which is a property of the main class being serialized); it looks as follows:
public class Contact
{
public ContactRoleType ContactRole;
public string ContactID;
// ....and some more fields...
}
The ContactRoleType is a normal enum. All fields are serialized, except the enum field ContactRole. Strange thing is, when I rename the member field ContactRole, it does get serialized.
I have actually used Chris Sells' excellent tool XmlSerializerPreCompiler , and all the types can be serialized without any problem.
All comments and ideas are welcomed!
Thanks!