笔记:xml序列化
/// <summary>
/// xml序列化
/// </summary>
/// <param name="root"></param>
/// <param name="dic"></param>
/// <returns></returns>
private static XElement XmlSerialize(string root,Dictionary<string, object> dic) { XElement el = new XElement(root, dic.Select(kv => new XElement(kv.Key, kv.Value))); return el; } private static List<XElement> XmlSerialize(Dictionary<string, object> dic) { List<XElement> list = new List<XElement>(); foreach (var item in dic) { list.Add(new XElement(item.Key, item.Value)); } return list; }