【发布时间】:2013-04-05 15:07:58
【问题描述】:
我有一个可观察的集合
var QueryList = new ObservableCollection<QueryData>();
假设我已经实现了一个 OnQueryListCollectionChanged 方法,用于触发此集合的 CollectionChanged 事件。诀窍是我希望这个方法在新线程上执行。
QueryList.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(new ThreadStart(OnQueryListCollectionChanged));
我知道上面的行不正确,但我不确定如何让 Collection 的 NotifyCollectionChangedEventHandler 委托将 OnQueryListCollectionChanged 方法指向新线程。
感谢任何帮助。
谢谢。
【问题讨论】:
标签: c# multithreading events event-handling observablecollection