c# - Resharper template for automatic INotifyPropertyChanged implementation -
is possible write code template or snippet following:
i have property declared this:
public string string1 {get;set;} and want reshaprer automatically generate following:
private string _string1; public string string1 { { return _string1; } set { if (_string1 != value) { _string1 = value; raisepropertychanged(() => string1); } } } just have read http://koder.wordpress.com/2010/03/25/resharper-inotifypropertychanged/ article , have created new live template can insert code new property want be.
is possible setup template in such way, can appear in alt+enter menu suggestion when cursor on declaration of property
like:
{access modifiers} **{type} {name}** {possible get;set; statements}
this live template came with, assigned 'npp' initiate it. don't think can ctrl-shift-r , replace it, can delete old property declaration line , type 'npp' invoke template.
private $type$ $name1$; public $type$ $name2$ { { return $name1$; } set { if ($name1$ == value) return; $name1$ = value; raisepropertychanged(() => $name1$); } }
Comments
Post a Comment