/// <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;
        }

 

相关文章:

  • 2022-12-23
  • 2021-05-28
  • 2022-02-13
  • 2021-07-27
  • 2021-08-08
  • 2021-12-18
  • 2021-11-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-02
  • 2021-12-15
  • 2022-01-21
  • 2021-12-15
  • 2021-05-30
相关资源
相似解决方案