It depends on what you actually want from the property. Assuming you want the value of the changed property, you can use reflection
to get it:
private void SomeObject_PropertyChanged(object sender, PropertyChangedEventArgs args)
{
object value =
sender.GetType().GetProperty(args.PropertyName).GetValue(sender, null);
}
If your needs are not fulfilled by reflection
you can still use string comparison and not worry about the property name changing by using the same mechanism you're using in the NotifyPropertyChanged
method. If you don't use one, you can use mine (code here):
private void SomeObject_PropertyChanged(object sender, PropertyChangedEventArgs args)
{
if (args.PropertyName == ExtendedObject.GetPropertyName(_ => _.Property1)
{
// ...
}
}