Cysharp / R3

The new future of dotnet/reactive and UniRx.
MIT License
1.72k stars 70 forks source link

Add ObservePropertyChanged, ObservePropertyChanging for `INotifyPropertyChanged`, `INotifyPropertyChanging` #151

Closed neuecc closed 4 months ago

neuecc commented 4 months ago

Add ObservePropertyChanged, ObservePropertyChanging extension methods for INotifyPropertyChanged, INotifyPropertyChanging.

This is the same as requested in #116, but implemented more efficiently. @michaelstonis , thank you for the idea. I had originally implemented it with ReactiveProperty as well, and realized that by using CallerArgumentExpression, we can avoid duplicate name specifications and reflection. So, I decided to add it to the core.

michaelstonis commented 4 months ago

This is wonderful.

It would be great if this could support nested properties like x => x.First.Second and I completely understand why that is not included for a first implementation. Would there be any interest in having support like that added? There are a lot of cases where having access to the second (and rarely third tier of property) can be extremely helpful. I would be glad to take a shot at it, if so.

neuecc commented 4 months ago

Would there be any interest in having support like that added?

It would be nice to have.