How to serialize object with List inside in C# using XElement?
问题 I have object with members of different types like this: public class MyObject { public string Str1 = string.Empty; public MyEnums.Enum1 E1 = MyEnums.Enum1.Unknown; public bool Done = false; }; I have Dictionary of these objects: Dictionary<string, MyObject> MyObjectsDic = new Dictionary<string, MyObject>(); And serializer for it like this: public static void ToXml(string file, string collectionName, Dictionary<string, object> collection) { XElement root = new XElement(collectionName); root