Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmontemagno/23ef2a942eef771045f366e3ce85536a to your computer and use it in GitHub Desktop.
Save jamesmontemagno/23ef2a942eef771045f366e3ce85536a to your computer and use it in GitHub Desktop.
var eventAsObservable = Observable.FromEvent<PropertyChangedEventHandler, PropertyChangedEventArgs>(
ev => this.PropertyChanged += ev,
ev => this.PropertyChanged -= ev)
.Where((e, b) => e.PropertyName == nameof(Text));
eventAsObservable
.Throttle(TimeSpan.FromMilliseconds(250))
.Subscribe(e =>
{
//do stuff
});
@adamhill
Copy link

adamhill commented May 5, 2019

Use FromEventPattern() – we have the same weird 'mismatches' in Unity, because there are similarly named extension Methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment