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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:25:45+00:00 2026-06-13T07:25:45+00:00

I was trying out System.Json (Beta) from NuGet. Also, trying to understand this new

  • 0

I was trying out System.Json (Beta) from NuGet. Also, trying to understand this new async/await stuff, just started Tinkering with Visual Studio 2012.

Wondering if using a ContinueWith if the await blocks until the whole thing is complete?

E.g, is this:

JsonValue json = await response.Content.ReadAsStringAsync().ContinueWith<JsonValue>(respTask => JsonValue.Parse(respTask.Result));

The same as:

        string respTask = await response.Content.ReadAsStringAsync();
        JsonValue json = await Task.Factory.StartNew<JsonValue>(() => JsonValue.Parse(respTask));

?

  • 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-13T07:25:47+00:00Added an answer on June 13, 2026 at 7:25 am

    Those are similar but not identical.

    ContinueWith returns a Task representing the continuation. So, to take your example:

    JsonValue json = await response.Content.ReadAsStringAsync()
        .ContinueWith<JsonValue>(respTask => JsonValue.Parse(respTask.Result));
    

    Consider just the expression:

                           response.Content.ReadAsStringAsync()
        .ContinueWith<JsonValue>(respTask => JsonValue.Parse(respTask.Result));
    

    The result of this expression is a Task representing the continuation scheduled by ContinueWith.

    So, when you await that expression:

                     await response.Content.ReadAsStringAsync()
        .ContinueWith<JsonValue>(respTask => JsonValue.Parse(respTask.Result));
    

    You are indeed awaiting the Task returned by ContinueWith, and the assignment to the json variable will not take place until the ContinueWith continuation has completed:

    JsonValue json = await response.Content.ReadAsStringAsync()
        .ContinueWith<JsonValue>(respTask => JsonValue.Parse(respTask.Result));
    

    Generally speaking, I avoid ContinueWith when writing async code. There’s nothing wrong with it, but it’s a bit low-level and the syntax is more awkward.

    In your case, I would do something like this:

    var responseValue = await response.Content.ReadAsStringAsync();
    var json = JsonValue.Parse(responseValue);
    

    I would also use ConfigureAwait(false) if this were part of a data access layer, but since you’re accessing response.Content directly I assume that you’ll need the ASP.NET context later in this method.

    Since you’re new to async / await, you may find my async / await intro helpful.

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

Sidebar

Related Questions

we're rolling out a new voicemail system, and trying to figure out a way
I'm trying to execute this JSON call as follows: button.setOnClickListener(new OnClickListener() { @Override public
I'm completely new to both VB.NET and JSON, and I'm trying to figure out
I'm trying to write Unicode characters (♠) using System.out , and a question mark
I was trying to pass a string object to System.out.printf(...) in Java, but I
I am trying to find out the difficulty of implementing a queue system. I
I'm trying to figure out why I would use a grid system. I have
I'm trying to work with how our system spits out its code for a
I’m new to android,I have an activity class which fetches Json string from url
I'm trying to parse a JSON object, part of which looks like this: {

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.