0
我正在申请一个'滑雪胜地',您可以在其中添加成员和搜索成员等等。到目前为止,我在应用程序关闭时无法保存和加载这些应用程序。当我添加一个成员时,它会保存,然后当我尝试添加另一个成员时,第一个成员将不再保存,但第一个成员已经完成。 这里是用来保存成员的代码:麻烦保存C#WPF
public void Save(System.IO.TextWriter textOut)
{
textOut.WriteLine(number);
textOut.WriteLine(name);
textOut.WriteLine(address);
textOut.WriteLine(score);
textOut.Close();
}
public bool Save(string filename)
{
System.IO.TextWriter textOut = null;
try
{
textOut = new System.IO.StreamWriter(filename);
Save(textOut);
}
catch
{
return false;
}
finally
{
if (textOut != null)
{
textOut.Close();
}
}
return true;
}