Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 997015
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:57:58+00:00 2026-05-16T06:57:58+00:00

I have an INotifyPropertyChanged object, Foo. I turn Foo into an observable stream of

  • 0

I have an INotifyPropertyChanged object, Foo. I turn Foo into an observable stream of events using Rx’s FromEvent method:

var myFoo = new Foo();
var eventStream = Observable.FromEvent<PropertyChangedEventArgs>(myFoo, "PropertyChanged");

Now I want to listen for a particular property changed, and if .Progress == 100, unsubscribe:

eventStream
   .Where(e => myFoo.Progress == 100)
   .Subscribe(OnFooFinished);

How can I unsubscribe when Progress == 100? If I add a .Take(1) call after the .Where clause, would that automatically unsubscribe?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:57:58+00:00Added an answer on May 16, 2026 at 6:57 am

    One option is to use return value of Subscribe:

    IDisposable subscription = eventStream.Where(e => myFoo.Progress == 100)
                                          .Subscribe(OnFooFinished);
    
    ...
    
    // Unsubscribe
    subscription.Dispose();
    

    I suspect that using Take(1) would indeed unsubscribe though, and it may be neater for you. Having looked at it a bit, I’m pretty sure this would unsubscribe, as it’ll fire the “completed” message, which generally unsubscribes automatically. I don’t have time to check this for sure at the moment, I’m afraid 🙁

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have an object that implements INotifyPropertyChanged, and I have a property that
I have a derived DataGridView bound to a BindingList, and the object implements iNotifyPropertyChanged.
I have a data object used to contain my UI data that supports INotifyPropertyChanged
I have an object which has properties. These are wired up with INotifyPropertyChanged. I
I have the following method in a base class that implements System.ComponentModel.INotifyPropertyChanged: protected virtual
I have an object that downloads a file from a server, saves it into
I have a custom object that implements INotifyPropertyChanged. I have a collection of these
I have a ListBox which happily displays data using a code-behind MVVM object. However,
I'm starting with a new application using silverlight and the first problem I have
I have a class that implements the INotifyPropertyChanged interface. If I create a new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.