保存可观察集合
public class MyDoc
{
public string Private {set;get;}
public string Public {set;get;}
}
public class MyFind
{
public string Find {set;get;}
public string News {set;get;}
private ObservableCollection<MyDoc> _smalllist;
public ObservableCollection<MyDoc> SmallList
{
get
{
if (_smalllist == null)
{
_smalllist = new ObservableCollection<MyDoc>();
}
return _smalllist;
}
set
{
if (_smalllist != value)
{
_smalllist = value;
}
}
}
}
public class Ask
{
private ObservableCollection<MyFind> _Biglist;
public ObservableCollection<MyFind> BigList
{
get
{
if (_Biglist == null)
{
_Biglist = new ObservableCollection<MyFind>();
}
return _Biglist;
}
set
{
if (_Biglist != value)
{
__Biglist = value;
}
}
}
}
我如何保存IsolatedStorage的小列表和大列表?
(“重要:进入 BigList 需要 2 个字符串和 1 个 ObservableCollection<>”)。
我们可以在类 MyFind 中看到一个 ObservableCollection ,并且类 MyAsk 中的 2 个字符串也有一个 ObservableCollection
public class MyDoc
{
public string Private {set;get;}
public string Public {set;get;}
}
public class MyFind
{
public string Find {set;get;}
public string News {set;get;}
private ObservableCollection<MyDoc> _smalllist;
public ObservableCollection<MyDoc> SmallList
{
get
{
if (_smalllist == null)
{
_smalllist = new ObservableCollection<MyDoc>();
}
return _smalllist;
}
set
{
if (_smalllist != value)
{
_smalllist = value;
}
}
}
}
public class Ask
{
private ObservableCollection<MyFind> _Biglist;
public ObservableCollection<MyFind> BigList
{
get
{
if (_Biglist == null)
{
_Biglist = new ObservableCollection<MyFind>();
}
return _Biglist;
}
set
{
if (_Biglist != value)
{
__Biglist = value;
}
}
}
}
How can i save IsolatedStorage the Small list, and Big list ?
("Important : into the BigList need got 2 string and 1 ObservableCollection<> ").
We can see in class MyFind has got an ObservableCollection and 2 string in class MyAsk has got an ObservableCollection
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要创建自己的可序列化可观察集合,如下所示:检查此 http://kentb .blogspot.com/2007/11/serializing-observablecollection.html
另一个选择是创建 IList 支持字段并创建包装ObservableCollection 属性标记为不可序列化
You need to create your own serializable observable collection as this: Check this http://kentb.blogspot.com/2007/11/serializing-observablecollection.html
another option is to crate IList backing fields and create a wrapping ObservableCollection properties marked as Non-Serializable