Resharper template for automatic INotifyPropertyChanged implementation

admin

Administrator
Staff member
Is it possible to write code template or a snippet which will do following:

I have a property declared like this:

Code:
public string String1 {get;set;}

And I want reshaprer to automatically generate following:

Code:
private string _string1;
public string String1
{
    get
    {
        return _string1;
    }

    set
    {

        if (_string1 != value)
        {
            _string1 = value;
            RaisePropertyChanged(() => String1);
        }
    }
}

Just have read the <a href="http://koder.wordpress.com/2010/03/25/resharper-inotifypropertychanged/">http://koder.wordpress.com/2010/03/25/resharper-inotifypropertychanged/</a> article and have created new live template which can insert code for a new property like I want it to be.

Is it possible to setup this template in such way, that it can appear in the Alt+Enter menu like a suggestion when cursor on the declaration of a property

Like:

Code:
{Access modifiers} **{Type} {Name}** {Possible get;set; statements}