Skip to content

ReSharper NPP Template

Marc Rousavy edited this page Aug 21, 2018 · 3 revisions

If you are not using ReSharper, you can also download the inpcp snippet and import it in Tools > Code Snippets Manager (See Create a Code Snippet 🌐)


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