0

In C# I would like to code this for all my Static variable:

public static int Secs {
  get {
    return secs;
  }
  set {
    secs = value;
    PropertyChanged();
  }
}

Is there any shortcut way to achieve the same thing. Sorry I don't mean a shortcut way to write it like typing "prop". I mean some way that all of the above could be written in one line.

  • Have a look at this question: https://stackoverflow.com/questions/19514413/using-a-code-snippet-for-inotifypropertychanged – Michael Aug 12 '17 at 10:08
  • Do you mean a some snippet for generation this code or a some more elegant and compact way for sending `PropertyChanged` and setting `value`? – George Alexandria Aug 12 '17 at 10:09

1 Answers1

0

There is no way in Visual Studio to generate as you mentioned above , but you can generate get; and set; with type "prop" or "propfull" and then press tab twice. That will generate the following.

public TYPE Type { get; set; }

But if you really want to achieve, as michael mentioned follow Resharper way

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396