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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:53:33+00:00 2026-06-14T15:53:33+00:00

I have the following code in VB.NET that reads measurements from a laser until

  • 0

I have the following code in VB.NET that reads measurements from a
laser until a workpiece has been rotated 480 degrees. All in all
a very nice application of CTP and RX together.

Dim measurementsList = Await machine.
    Measurements.
    TakeUntil(machine.Driver.RotateC(480, 10).ToObservable()).
    ToList()

Note machine.Measurements is IObservable(of double) in this case and are
readings from a laser measuring device on a network.

However I was considering adding an extension method to IObserverable
( Now C# code )

public static IObservable<T> TakeUntil<T,R>(this IObservable<T> This, Task<R> other){
    return This.TakeUntil(other.ToObservable());
}

It’s really not a big deal and would enable me to write my code as

Dim measurementsList = Await machine.
    Measurements.
    TakeUntil(machine.Driver.RotateC(480, 10)).
    ToList()

which seems more fluent but given that RX does not provide such an
obvious overload perhapps I am missing the obvious reason such an
overload is a bad idea. Should I add this or stick with the explicit
conversion?

(btw should not the tags async-ctp and async-await be merged)

  • 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-14T15:53:35+00:00Added an answer on June 14, 2026 at 3:53 pm

    There’s nothing wrong with what you are doing, but I’d review Rx v2.0 and .NET 4.5 “async” / “await” – a better together story, from the lengthy and informative post by Bart De Smet.

    You may also want to check out Linq-to-Await to see how things are done there. In fact, if you look at the few operators, you’ll see that your method is quite similar, except in your case you are taking just a Task, where in Paul Betts Linq-To-Await, he uses Func<T, Task<R>>. In which case your code could look like this (with a Func with no parameters):

    public static IObservable<T> TakeUntil<T,R>(this IObservable<T> This, Func<Task<R>> other){
        return This.TakeUntil(other().ToObservable());
    }
    
          var q = Measurements.TakeUntil(async () => await machine.Driver.RotateC(480, 10));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following code that I am compiling in a .NET 4.0 project namespace
I have the following code that is working fine in jsfiddle - http://jsfiddle.net/darkajax/FHZBy/ I've
I have an small ASP.NET application that reads data from a table and sends
I have the following code that uses Sequence objects to read data from a
I have following asp.net code but it gives error when I change dropdown selected
I have the following code: http://jsfiddle.net/uRCL2/1 At the moment the result is shown in
Anything I have tried didn't work. Currenly I have following code to change asp.net
I have the following code setup: http://jsfiddle.net/bABHU/2/ Had to change it a little bit
I have the following code in my ASP.NET project public sealed class IoC {
I have the following code in a full .NET framework solution: public delegate int

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.