我看到一个可观察队列类here的实现。我发现了两件事我不明白: 1.事件,名称PropertyChanged和CollectionChanged已经在基类中定义。为什么你不必使用'新'?类层次结构中的事件
public virtual event NotifyCollectionChangedEventHandler CollectionChanged;
2.将PropertyChanged事件以simelar方式声明为属性。你为什么这样做?
protected virtual event PropertyChangedEventHandler PropertyChanged;
event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged
{
add { this.PropertyChanged += value; }
remove { this.PropertyChanged -= value; }
}
只是再看看答案,你是对的。认为基类是ObservableCollection。谢谢! – R3turnz