chuongmep / RevitAddInManager

Revit AddinManager update .NET assemblies without restart Revit for developer.
MIT License
275 stars 50 forks source link

Correct usage of INotifyPropertyChanged #12

Closed Nice3point closed 2 years ago

Nice3point commented 2 years ago

https://github.com/chuongmep/RevitAddInManager/blob/8faa9fff26524c74eb5aadeb4e6bf3ae115c69cd/AddInManager/ViewModel/AddInManagerViewModel.cs#L36

The INotifyPropertyChanged interface provides a method: private void OnPropertyChanged([CallerMemberName] string propertyName = null)

Here is the correct use case for property with notification:

public string CommandItems  
{
    get => _commandItems;
    set
    {
        if (value == _commandItems) return;
        _commandItems = value;
        OnPropertyChanged();
    }
}

Using ref and other overloads is superfluous.

chuongmep commented 2 years ago

Many thanks @Nice3point, fixed include application