I would suggest using such a blank.
First, you define the base class for your VMs:
class VM : INotifyPropertyChanged { protected bool Set<T>(ref T field, T value, [CallerMemberName] string propertyName = null) { if (EqualityComparer<T>.Default.Equals(field, value)) return false; field = value; RaisePropertyChanged(propertyName); return true; } protected void RaisePropertyChanged([CallerMemberName] string propertyName = null) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); public event PropertyChangedEventHandler PropertyChanged; }
Then, in your VM classes, you write this:
class GraphVM : VM { private bool _isGraphSet; public bool isGraphSet { get { return _isGraphSet; } private set { Set(ref _isGraphSet, value); } } }
For IL-weavers like Fody, I have an ambiguous attitude.
On the one hand, AOP is as if good and correct.
On the other hand, there are bugs with Fody. Worse, since code generation happens behind the scenes, it is unlikely that you can easily debug related problems if something went wrong: you don’t have the source code!
Therefore, I would wait until replace / original ( here and here ) is implemented in C # to have full control over the code generation with the possibility of step-by-step debugging.