高手进来解释一下
我今天读了以下2段代码,有所不清楚,望告诉作答.谢谢
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
namespace KPIReportsApp
{
[Serializable]
public abstract class Settings <T>
{
protected abstract T GetDefault();
protected abstract string GetFilename();
protected T Load()
{
if (File.Exists(GetFilename()))
{
BinaryFormatter bf = new BinaryFormatter();
using (FileStream fs = new FileStream(GetFilename(), FileMode.OpenOrCreate))
{
return (T) bf.Deserialize(fs);
}
}
return GetDefault();
}
public void Save()
{
BinaryFormatter bf = new BinaryFormatter();
using (FileStream fs = new FileStream(GetFilename(), FileMode.OpenOrCreate))
{
bf.Serialize(fs, this);
}
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace KPIReportsApp
{
[Serializable]
public class DailyReportFormSettings : Sett