两个结果集,一个“Observable<string>() testone ”和"List<string>() testtwo ",testone 和testtwo 两者之间应该怎样转化???转化过程是不是很消耗资源???
解决方案 »
- .net C#爱普生打印机利用code128字体打印条形码时怎么选择code128字体
- 急急急,dll引用问题
- 怎样点击下载文件而不是直接打开
- PropertyGrid中MSChart控件的Annotations集合编辑器的问题
- 水晶报表打印问题
- How to determine is there any data stored on the clipboard in C#?
- 求指点下淘宝登录 webbowser控件
- 求助关于Microsoft Visual Studio Tools for the Microsoft Office System的问题!!!
- 大家好,在C#里怎么执行DOS命令?
- 求高手帮忙,写一个dll,使IIS里的某个站点返回错误均是200.【很诚恳】
- 关于c#开启单独线程的的问题,指定端口扫描程序的实现
- 编了一个窗体游戏,想弄个重玩按钮,怎么让程序从头开始执行?
Observable<string>?你说的是 ObservableCollection<string>吧?就是遍历List<string>然后一个一个插入到集合里边去呗。至于你说的“消耗资源”,我不知道你说的是什么资源,不好随便下结论。做任何事都是需要消耗资源资源的,唯一不消耗资源的的做法就是什么都不做。所以还是要看懂你自己所需。
自己看吧:public ObservableCollection(List<T> list) : base((list != null) ? new List<T>(list.Count) : list)
{
this._monitor = new SimpleMonitor<T>();
this.CopyFrom(list);
}private void CopyFrom(IEnumerable<T> collection)
{
IList<T> items = base.Items;
if ((collection != null) && (items != null))
{
using (IEnumerator<T> enumerator = collection.GetEnumerator())
{
while (enumerator.MoveNext())
{
items.Add(enumerator.Current);
}
}
}
}