Implement [CallerMemberName] for RaisePropertyChanged


Hi it would be great to have a propertychanged call with the callermembername attribute for .net 4.5 applications

        protected virtual void RaiseThisChanged([CallerMemberName] string propertyName = "")

            var handler = PropertyChanged;
            if (handler != null)
                handler(this, new PropertyChangedEventArgs(propertyName));
But it would be better to name it to RaiseThisChanged or something because you wouldn't be able to use the normal RaisePropertyChanged("Property") call.
Closed Oct 14, 2014 at 9:34 PM by lbugnion


PjlCodeplex wrote Mar 2, 2013 at 8:22 PM

I agree. ViewModelBase could also be extended with
    public bool Set<T>(ref T field, T value, [CallerMemberName] string propertyName = "")
        return this.Set(propertyName, ref field, value);

dbalboa wrote Mar 20, 2013 at 10:03 AM

+1. This is a great feature added to c# 5.0 that i would like to see implemented on this toolkit!

Havremunken wrote Jun 12, 2013 at 7:02 AM

+1 here. Apparently this is an efficient way to do things, please support. :)

lbugnion wrote Jun 12, 2013 at 7:57 AM

Hey there,

This is already implemented, i will publish with V4.2. Expect a preview on Codeplex very soon with other improvements.