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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:26:22+00:00 2026-06-11T14:26:22+00:00

I’m following the await tutorial on the MSDN, and I’m trying to figure out

  • 0

I’m following the await tutorial on the MSDN, and I’m trying to figure out the difference between using await as a statement versus using await as an expression. This whole async-await thing is bending my mind and I can’t find any examples for this particular case.

Basically, I wanted to see how to use multiple awaits asynchronously, meaning I don’t want to have to wait for the first one to complete before the second one begins. This, to me, defeats the purpose of asynchrony to begin with:

private async void button1_Click(object sender, EventArgs e)
{
    // Using await as an expression
    string result_a = await WaitAsynchronouslyAsync();
    string result_b = await WaitAsynchronouslyAsync();

    // This takes six seconds to appear
    textBox1.Text = result_a + Environment.NewLine;
    textBox1.Text += result_b;
}

public async Task<string> WaitAsynchronouslyAsync()
{
    await Task.Delay(3000);
    return "Finished";
}

However, with a subtle change it only takes 3 seconds total for the two “Finished”s to appear, which is what I’d want — the two awaits running truly asynchronously:

private async void button1_Click(object sender, EventArgs e)
{
    var a = WaitAsynchronouslyAsync();
    var b = WaitAsynchronouslyAsync();

    // Using await as a statement
    await a;
    await b;

    // This takes three seconds to appear
    textBox1.Text = a.Result + Environment.NewLine;
    textBox1.Text += b.Result;
}

My question is, why do these behave differently? What subtle point am I missing here?

  • 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-11T14:26:23+00:00Added an answer on June 11, 2026 at 2:26 pm

    Firstly, you need to distinguish between parallelism and asynchrony. In the first case, it could easily still be worth performing the operations synchronously (and indeed the second operation may depend on the results of the first) in order to free up the UI thread etc.

    But as for why they behave differently – await is only an expression. It’s the kind of expression which can appear as a statement, but it will behave the same way, just like calling a method which returns a string, but ignoring the return value. You can see that by changing your first code to:

    // Still takes 6 seconds...
    var a = WaitAsynchronouslyAsync();
    await a;
    
    var b = WaitAsynchronouslyAsync();
    await b;
    

    That will still take 6 seconds. The point is that you’re only starting the second asynchronous operation after you’ve waited for the first one to finish. In your second example, both asynchronous operations occur at the same time.

    You can still do that and assign the value to a variable, you just need to remember the awaitables:

    // This will only take 3 seconds
    var a = WaitAsynchronouslyAsync();
    var b = WaitAsynchronouslyAsync();
    string result_a = await a;
    string result_b = await b;
    

    So basically, the difference isn’t to do with statement/expression – it’s to do with whether the sequence is start/await/start/await or start/start/await/await.

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to create an if statement in PHP that prevents a single post
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

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.