SaveXml的方法汇总
2016-05-17 13:25
363 查看
/// <summary>
/// 保存XML文件
/// </summary>
/// <returns></returns>
public bool SaveXml()
{
//删除原配置文件
if (System.IO.File.Exists(getCallRecodXMLPath()))
{
System.IO.File.Delete(getCallRecodXMLPath());
}
//生成新的配置文件
XmlSerializer ser = new XmlSerializer(typeof(DataSet));
try
{
if (dtCallRecord != null)
{
using (TextWriter writer = new StreamWriter(getCallRecodXMLPath()))
{
ser.Serialize(writer, dsCallRecord);
}
return true;
}
}
catch (System.Exception ex)
{
TestLog.GetInstance().RecordLog("*******************通话记录文件序列化异常************" + ex.Message);
}
return false;
}
/// 保存XML文件
/// </summary>
/// <returns></returns>
public bool SaveXml()
{
//删除原配置文件
if (System.IO.File.Exists(getCallRecodXMLPath()))
{
System.IO.File.Delete(getCallRecodXMLPath());
}
//生成新的配置文件
XmlSerializer ser = new XmlSerializer(typeof(DataSet));
try
{
if (dtCallRecord != null)
{
using (TextWriter writer = new StreamWriter(getCallRecodXMLPath()))
{
ser.Serialize(writer, dsCallRecord);
}
return true;
}
}
catch (System.Exception ex)
{
TestLog.GetInstance().RecordLog("*******************通话记录文件序列化异常************" + ex.Message);
}
return false;
}
相关文章推荐
- <<Effective C++>>读书笔记5: 实现
- Java EnumMap工作原理及实现(二)
- 这是我的第一篇博客
- Android自定义控件(含简单栗子)
- Ehcache详细解读
- Java序列化与反序列化
- 数组——蛇形矩阵、螺旋矩阵
- Swift开发入门:按钮(UIButton)空间
- Android ListView 点击事件无法获得焦点简析
- 第12周-项目1(2)
- bzoj4591 [Shoi2015]超能粒子炮·改
- Android环境搭建
- POJ 2104 K-th Number 划分树
- 互联网秒杀业务架构设计 / 秒杀系统架构分析与实战
- C#与C++(结构体内对象指定大小)
- ios app打ipa包
- 详解Office 外接程序 COM Add In的LoadBehavior及其妙用
- LoadRunner下设置监控Windows系统资源
- Unity AssetDatabase和Resources资源管理
- iOS --统一导航栏“返回”键,并当push隐藏控制器底部tabBar