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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:21:27+00:00 2026-05-27T10:21:27+00:00

I am looking at implementing an API where multiple operations can run concurrently. The

  • 0

I am looking at implementing an API where multiple operations can run concurrently. The Event-based Asynchronous Pattern has been recommended by MS:

// Asynchronous methods.
public void Method1Async(string param, object userState);
public event Method1CompletedEventHandler Method1Completed;

public void CancelAsync(object userState);
public bool IsBusy { get; }

However this seems a little clumsy to be – it requires clients to filter out replies which are not meant for them and disconnect the event handler when done etc. What I thinking is something more like:

AsyncOperation1(string parm, Action<T> callback)

Each client gets get’s its own results delivered directly. I am having trouble figuring out how to support cancelation elegantly. I guess the obvious thing is for AsyncOperation1 to return some kind of token which can be passed into a CancelAsync method. I’d like to find out more about what other async patterns are in common usage in .Net or in other languages that can be translated appropriately

  • 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-27T10:21:28+00:00Added an answer on May 27, 2026 at 10:21 am

    Take a look at Reactive Extensions, you can return an Observable which can be subscribed to by the clients.

    The subscription returns an object that implements IDisposable which is the mechanism to cancel the subscription, just dispose of the object.

    For example:

    IObservable<T> o = Method1Async(params);
    
    var observer = o.Subscribe(r => {/*do stuff with the result*/},
                               ex => {/* do stuff with the exception */);
    
    // decide to cancel
    observer.Dispose();
    

    You can install the Reactive Extensions bits using nuget, just “install-package rx-main”

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

Sidebar

Related Questions

I have been looking at using TDD and implementing proper testing (only just started
I am looking at implementing a Web Service API for our product. I have
I've been looking at the DropBox Mac client and I'm currently researching implementing a
I have been looking arund at implementing Gravatar for all my users profile pictures
I'm looking at implementing a failover mechanism for a MySQL database using MySQL Proxy
I'm looking at implementing some form of anonymous user system in Rails. I need
We are looking at implementing a caching framework for our application to help improve
I'm looking at implementing an RDBMS. Are there any good resources out there about
I am looking for good ideas for implementing a generic way to have a
I'm looking for good patterns for implementing a paged table of results in ASP.NET

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.