/// <summary>
/// 保存配置
/// </summary>
public int Save()
{
try
{
XmlSerializer xs = new XmlSerializer(typeof(ConfigureMessageTY));
string path = AppDomain.CurrentDomain.BaseDirectory + @"ConfigXml\ContentMessageTY.Config";
if (!Directory.Exists(Path.GetDirectoryName(path)))
Directory.CreateDirectory(Path.GetDirectoryName(path));
using (StreamWriter sw = new StreamWriter(path))
{
xs.Serialize(sw, this);
sw.Close();
return 1;
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message+"-------"+ex.StackTrace);
return 0;
}
}xs.Serialize(sw, this);在执行这句花时出现异常,异常信息“生成XML文档出错”,也不知道是什么原因
解决方案 »
- C#的DataGridView排序的问题?
- C#图片导出到EXCEL
- DropDownList绑定数据源
- OdbcConnection 连接字符串的路径部分带有空格 (急,在线等)
- 求一段Gridview写入数据库的代码,谢谢。
- Remoting 技术 (不认识DataSet数据类型),Remoting高手请进
- 什么问题(button的新建)?
- 求救!!水晶报表字段的动态添加!
- 博士都头疼的问题,请大家帮忙
- .NET Framework主要由公共语言运行时(CLR)和基础类库(BCL)两部分组成。请问常用的类(比如Console类)是不是就在基础类库(BCL)里面?
- 两个byte数组合并后,数据丢失了。
- 求教数组排序后的问题
<system.diagnostics>
<switches>
<add name="XmlSerialization.Compilation" value="4" />
</switches>
</system.diagnostics>