C# DataContractSerializer SerializationException with Enum set in object field
问题 Given the following code, [DataContract] public class TestClass { [DataMember] public object _TestVariable; public TestClass(object value) { _TestVariable = value; } public void Save() { using (XmlDictionaryWriter writer = XmlDictionaryWriter.CreateTextWriter(new FileStream("test.tmp", FileMode.Create))) { DataContractSerializer ser = new DataContractSerializer(typeof(TestClass)); ser.WriteObject(writer, this); } } } public enum MyEnum { One, Two, Three } Why does it fail to serialize when