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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:28:33+00:00 2026-06-12T16:28:33+00:00

Async CTP is very nice to use. I saw some examples for windows phone,

  • 0

Async CTP is very nice to use.
I saw some examples for windows phone, all using:
(Assembly AsyncCtpLibrary_Phone.dll, v2.0.50727, AsyncCtpExtensions).

 var client = new WebClient();
 string data = await client.DownloadStringTaskAsync(new Uri(url));

or something like the above code.

How can I use methods with async / await for my services? (WCF)
Today all methods work this way:

  service.MyRequestCompleted += service_myRequestCompleted;
  service.MyRequestAsync();

I can not find a way to use extension methods for services.

  • 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-12T16:28:34+00:00Added an answer on June 12, 2026 at 4:28 pm

    Unfortunetly, I haven’t found a good way to generalize this for any event, but it’s easy enough to adapt this for a particular event:

    public static Task WhenRequestCompleted(MyService service) //can make it an extension method if you want.
    {
        TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
    
        service.MyRequestCompleted += () => //change parameter list to fit the event's delegate
            {
                tcs.SetResult(null);
            };
        service.MyRequestAsync();
    
        return tcs.Task;
    }
    

    Then you can do:

    await WhenRequestCompleted(service);
    //code that runs after the request is completed.
    

    I assume you see the pattern here, so you could adapt this so that it would work with some other event on some other type.

    Oh, and if the event has arguments that are particularly important to you then you could make this return a Task<T> instead of a Task and instead of using tcs.SetResult(null) you could use one of the parameters of the lambda to set the result.

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

Sidebar

Related Questions

I am using the Async CTP library for Windows Phone. Does anyone know how
Would be glad to see some feedback from you in using async ctp in
I'm currently designing some internal APIs where I use the Async CTP and its
I've problem installing VS-SP1 and Async CTP V3 on my machine. For some reason
I am making some probes with async CTP but I don't get a good
From what I've seen about using the Async CTP with the event asynchronous pattern,
Using Visual Studio Async CTP (Version 3) I am struggling to understand how I
I installed the Async CTP Refresh on my Windows 7 machine with VS2010 Pro(which
I've come up against an issue here when wanting to use the async CTP
In looking at various C# Async CTP samples I see some async functions that

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.