Skip to content

ReSharper NPP Template

Marc Rousavy edited this page Jun 25, 2018 · 3 revisions

Create a custom template npp for INotifyPropertyChanged properties.

  1. Go to ReSharper > Tools > Templates Explorer..
  2. Switch to C# on the left side
  3. Click New Template in the top menu bar
  4. Use the following code:
private $TYPE$ $FIELDNAME$;
public $TYPE$ $PROPERTY$
{
    get => $FIELDNAME$;
    set => Set(ref $FIELDNAME$, value);
}
  1. On the right side, set:

    • Shortcut: npp
    • Description: INotifyPropertyChanged Backed Field Property
    • TYPE: Choose Macro
    • FIELDNAME: Suggest name for a variable
    • PROPERTY: Value of FIELDNAME with the first letter in upper case

    NPP Template

  2. Save to apply

In any .cs file you can write npp to insert the template at the current position (needs to be a class inheriting ObservableObject to work)

Result:

NPP Demo GIF

Clone this wiki locally