110,566
社区成员
发帖
与我相关
我的任务
分享
[Serializable()]
public class KeywordOptions
{
/// <summary>
/// 关键字
/// </summary>
public string Keyword { get; set; }
/// <summary>
/// 是否为系统定义的关键字
/// </summary>
public bool Defined { get; set; }
}
[Serializable()]
public class KeywordOptions
{
/// <summary>
/// 关键字
/// </summary>
public string Keyword { get; set; }
/// <summary>
/// 是否为系统定义的关键字
/// </summary>
public bool Defined { get; set; }
/// <summary>
/// 是否已选中做为搜索关键字配置
/// </summary>
public bool Selected { get; set; }
/// <summary>
/// 消息发布的日期是几天内的(默认 1天)
/// </summary>
public int Days { get; set; }
}
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
FileStream fs = new FileStream(@"c:\\myKeywords.dat", FileMode.Open, FileAccess.Read);
fs.Seek(0, SeekOrigin.Begin);
using (fs)
{
this.MyKeywords = (StockList<KeywordOptions>)bf.Deserialize(fs);// 这里会出错
fs.Close();
}