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 8308915
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:56:51+00:00 2026-06-08T18:56:51+00:00

For an Rx based change tracking solution I am in need of an operator

  • 0

For an Rx based change tracking solution I am in need of an operator which can get me the first and most recent item in an observable sequence.

How would I write an Rx operator that produces the following marble diagram (Note: the brackets are used just to lineup the items…I’m not sure how best to represent this in text):

     xs:---[a  ]---[b  ]-----[c  ]-----[d  ]---------|
desired:---[a,a]---[a,b]-----[a,c]-----[a,d]---------| 
  • 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-08T18:56:53+00:00Added an answer on June 8, 2026 at 6:56 pm

    Using the same naming as @Wilka you can use the below extension which is somewhat self-explanatory:

    public static IObservable<TResult> FirstAndLatest<T, TResult>(this IObservable<T> source, Func<T,T,TResult> func)
    {
        var published = source.Publish().RefCount();
        var first = published.Take(1);        
        return first.CombineLatest(published, func);
    }
    

    Note that it doesn’t necessarily return a Tuple, but rather gives you the option of passing a selector function on the result. This keeps it in line with the underlying primary operation (CombineLatest). This is obviously easily changed.

    Usage (if you want Tuples in the resulting stream):

    Observable.Interval(TimeSpan.FromSeconds(0.1))
              .FirstAndLatest((a,b) => Tuple.Create(a,b))
              .Subscribe(Console.WriteLine);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get a WordPress image to change based on which tab
The calender app does it... How can I make an app icon change based
I need to change the background of one of my Views based on a
I'm maintaining an home-brew web-based help-desk solution and we are experiencing an erroneous change
Based on this link it looks like I can get date inserted / date
Need to design several ASP.Net Web Forms that change based on User Type and
I need to automatically change Google Maps marker icons based on the inner content
Is there a way to block a given change based on the user role?
I'm trying to change view controllers based on a user's selection in a UIAlertView
I am looking how to change a logo based on either class in the

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.