Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
インデクサをIObservable<T>に変更する拡張メソッド
public static class PropertyChangedExtensions
{
public static IObservable<PropertyChangedEventArgs> ObserveIndexer(this INotifyPropertyChanged self, string indexerName = "Item")
{
return Observable.FromEvent<PropertyChangedEventHandler, PropertyChangedEventArgs>(
h => (s, e) => h(e),
h => self.PropertyChanged += h,
h => self.PropertyChanged -= h)
.Where(e => e.PropertyName == indexerName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.