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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:36:48+00:00 2026-05-16T18:36:48+00:00

Yesterday I watched the screencast Writing your first Rx Application (on Channel 9) where

  • 0

Yesterday I watched the screencast Writing your first Rx Application (on Channel 9) where Wes Dyer shows how to implement Drag ‘n’ Drop using Reactive Extensions (Rx). Something that I still don’t understand:

Towards the end of the screencast, Wes Dyer types in the following:

var q = from start in mouseDown
        from delta in mouseMove.StartsWith(start).Until(mouseUp)
                       .Let(mm => mm.Zip(mm.Skip(1), (prev, cur) =>
                           new { X = cur.X - prev.X, Y = cur.Y - prev.Y }))
        select delta;

Briefly, q is an observable that pushes the mouse move coordinate deltas to its subscribers.

What I don’t understand is how the mm.Zip(mm.Skip(1), ...) can possibly work!?

As far as I know, IObservable is not enumerable in the sense that IEnumerable is. Thanks to the “pull” nature of IEnumerable, it can be iterated over again and again, always yielding the same items. (At least this should be the case for all well-behaved enumerables.) IObservable works differently. Items are pushed to the subscribers once, and that was it. In the above example, mouse moves are single incidents which cannot be repeated without having been recorded in-memory.

So, how can the combination of .Zip with .Skip(1) possibly work, since the mouse events they’re working on are single, non-repeatable incidents? Doesn’t this operation require that mm is “looked at” independently twice?


For reference, here’s the method signature of Observable.Zip:

public static IObservable<TResult> Zip <TLeft, TRight, TResult>
(
    this IObservable<TLeft>       leftSource,     //  = mm
    IObservable<TRight>           rightSource,    //  = mm.Skip(1)
    Func<TLeft, TRight, TResult>  selector
)

P.S.: I just saw that there’s another screencast on the Zip operator which is quite insightful.

  • 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-16T18:36:49+00:00Added an answer on May 16, 2026 at 6:36 pm

    Doesn’t this operation require that mm is “looked at” independently twice?

    Thats in fact the answer of your question: You can subscribe to the same IObservable sequence multiple times.

    The mm.Skip(1) subscribes to mm and hides the first value to its own subscribers.
    Zip is a subscriber of both mm.Skip(1) and mm. Because mm yielded one more value than mm.Skip(1), Zip internally buffers the last mousemove event from mm all the time in order to zip it with the next future mousemove event. The selector function can then select the delta between both.

    Another thing you should notice is (which is the real answer to the title of your question), that this Observable.FromEvent–IObservable is a hot observable and therefore not repeatable. But there are cold Observables which are in fact repeatable, like Observable.Range(0,10). In the latter case each subscriber will receive the same 10 events, because they are generated independently for each subscriber. For mousemove events this is not the case (you wont get mouse move events from the past). But because Zip subscribes to the right and left sequence at the same time its likely the same in this case.

    P.S.: You can also crate a hot / not repeatable IEnumerable: It does not need to return the same values for each enumerator. You could for instance create an IEnumerable which waits until a mousemove event occurs an then yield the event. In this case the enumerator would always block (bad design), but it would be possible. 😉

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

Sidebar

Related Questions

Yesterday I was trying to implement a Listener for a SelectManyListbox using Ajax in
Yesterday i implement Log4Net in my application. To use it i need to write
Yesterday I made myself a new my first App ID, all Certificates and downloaded
Yesterday I added a custom MembershipProvider to an ASP.NET web application, but when I
Yesterday I notice that some thing kept writing with 1.48M/s bursting speed every 30s
yesterday I watched Google IO Talk about NFC and today I'm trying to do
Good morning! Yesterday I watched Tekpub's amazing video Dependency Injection and Inversion of Control
Yesterday I've discovered that Bash provides a means to mark variables as read-only, using
Yesterday, after about two years we re-deployed our application. Code hasn't changed, but the
Yesterday I've got a task to implement a validation on the field where user

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.