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

  • Home
  • SEARCH
  • 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 8503001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:38:22+00:00 2026-06-11T01:38:22+00:00

How many times is Reactive Extensions supposed to evaluate its various operators? I have

  • 0

How many times is Reactive Extensions supposed to evaluate its various operators?

I have the following test code:

var seconds = Observable
    .Interval(TimeSpan.FromSeconds(5))
    .Do(_ => Console.WriteLine("{0} Generated Data", DateTime.Now.ToLongTimeString()));

var split = seconds
    .Do(_ => Console.WriteLine("{0}  Split/Branch received Data", DateTime.Now.ToLongTimeString()));

var merged = seconds
    .Merge(split)
    .Do(_ => Console.WriteLine("{0}   Received Merged data", DateTime.Now.ToLongTimeString()));

var pipeline = merged.Subscribe();

I expect this to write “Generated Data” once every five seconds. It then hands off that data to both the ‘split’ stream which writes “Split/Branch received Data”, and to the ‘merged’ stream which writes “Received Merged data”. Last, because the ‘merged’ stream is also receiving from the ‘split’ stream, it receives the data second time and writes “Received Merged data” a second time. (The order it writes some of them in is not particularly relevant)

But the output I am getting is this:

8:29:56 AM Generated Data
8:29:56 AM Generated Data
8:29:56 AM  Split/Branch received Data
8:29:56 AM   Received Merged data
8:29:56 AM   Received Merged data
8:30:01 AM Generated Data
8:30:01 AM Generated Data
8:30:01 AM  Split/Branch received Data
8:30:01 AM   Received Merged data
8:30:01 AM   Received Merged data

It is writing “Generaged Data” twice. To my understanding, The number of downstream observers that are subscribed to the “seconds” IObservable should not affect the number of times that “Generated Data” writes (which should be ONCE), but it does. Why?

NOTE I am using the stable release v1.0 SP1 of reactive extensions in a .Net Framework 3.5 environment.

  • 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-06-11T01:38:23+00:00Added an answer on June 11, 2026 at 1:38 am

    Presumably, they choose that approach to allow each subscriber to get its values at the same interval from their initial subscription. Consider how your alternate Interval would work:

    0s - First subscriber subscribes
    5s - Value: 0
    8s - Second subscriber subscribes
    10s - Value: 1
    15s - Value: 2
    17s - Unsubscribe both
    

    What you end up with is something like this:

    First  -----0----1----2-|
    Second         --1----2-|
    

    In this case, the two observers have noticeably different results depending on whether or not there is any other observer already attached. As it is implemented, Interval gives the same experience to each subscriber regardless of order or past subscribers.

    All that said, you can “convert” Interval to the behavior you describe by adding .Publish().RefCount() when creating the seconds observable.

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

Sidebar

Related Questions

Many times I have seen code where they write a Class like this: public
Many times I work with optimized code (sometimes even involving vectorized loops), which contain
Many times I see statements like following Y.CustomApp.superclass.render.apply(this, arguments); I know how apply works.
How many times have you seen someone trying to Log the command I run
I have used NSSets many times in my apps, but I have never created
I have heard it many times that garbage collection in PyS60 is not up
Many times I only have made a little change for one page. How can
Many times I have member functions that copy parameters into object's fields. For Example:
There are many times when I need to test a little snippet of .NET
I googled this many times but now I have to ask it here. I

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.