/// <summary> /// 键值数据保存XML文件 /// </summary> /// <param name="fileName">文件名</param> /// <param name="data">数据</param> public static bool SaveXmlFile(string filePath, string fileName, SerializableDictionary<string, string> data) { if (!Directory.Exists(filePath)) { Directory.CreateDirectory(filePath); } using (FileStream fileStream = new FileStream(filePath + fileName, FileMode.Create)) { XmlSerializer xmlFormatter = new XmlSerializer(typeof(SerializableDictionary<string, string>)); xmlFormatter.Serialize(fileStream, data); } if (File.Exists(filePath + fileName)) { return true; } return false; }