我读MvvmLight的源代码,我已经看到了ViewModelBase.cs此功能:.NET将对象投射到...对象的目标是什么?
protected virtual void RaisePropertyChanged(string propertyName)
{
PropertyChangedEventHandler changedEventHandler = this.PropertyChanged;
if (changedEventHandler == null)
return;
changedEventHandler((object) this, new PropertyChangedEventArgs(propertyName));
}
我不明白为什么有一个投在这里,但因为这个功能在MvvmLight关键,我猜这样做是有优势的......
也许只是为了让读者清楚,'this'在事件处理程序中将被视为'object'。 –
似乎不受歧义问题等,也许只是作者的偏好。 – user7116