您的位置:首页 > 其它

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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: