I was reading the source code of MvvmLight, and I've seen this function in ViewModelBase.cs:
protected virtual void RaisePropertyChanged(string propertyName)
{
PropertyChangedEventHandler changedEventHandler = this.PropertyChanged;
if (changedEventHandler == null)
return;
changedEventHandler((object) this, new PropertyChangedEventArgs(propertyName));
}
I don't see why there is a cast here, but because this function is critical in MvvmLight, I'm guessing there is an advantage of doing so...
If you're looking at the code through Reflector
you'll always see strange stuff like this because Visual Studio lets you take short-cuts that the compiler works out for you, like passing a type as object without casting it to object.
But to answer your question, the eventhandler requires an object, so it passes this
as (object)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With