What is the difference between await Task<T> and Task<T>.Result?

I wont be wrong if I think that await will release the calling thread but Task.Result will block it, would it be right?

Generally, yes. await task; will "yield" the current thread. task.Result will block the current thread. await is an asynchronous wait; Result is a blocking wait.

There's another more minor difference: if the task completes in a faulted state (i.e., with an exception), then await will (re-)raise that exception as-is, but Result will wrap the exception in an AggregateException .

As a side note, avoid Task.Factory.StartNew . It's almost never the correct method to use. If you need to execute work on a background thread, prefer Task.Run .

Both Result and StartNew are appropriate if you are doing dynamic task parallelism; otherwise, they should be avoided. Neither is appropriate if you are doing asynchronous programming.

You're correct, as long as the task hasn't completed synchronously. If it did, using either Task.Result or await task will execute synchronously, as await will first check if the task has completed. Otherwise, if the task hasn't completed, it will block the calling thread for Task.Result , while using await will a synchronously wait for the tasks completion. Another thing that differs is exception handling. While the former will propagate an AggregationException (which may contain one or more exceptions), the latter will unwrap it and return the underlying exception.

As a side note, using asynchronous wrappers over sync methods is bad practice and should be avoided. Also, using Task.Result inside an async method is a cause for deadlocks and should also be avoided.

Multithreading

Async await, recent posts.

Debian

skip the navigation

You have searched for packages that names contain task-chinese-t in all suites, all sections, and all architectures. Found 4 matching packages.

Package task-chinese-t

Package task-chinese-t-desktop

Package task-chinese-t-gnome-desktop

Package task-chinese-t-kde-desktop

This page is also available in the following languages (How to set the default document language ):

To report a problem with the web site, e-mail [email protected] . For other contact information, see the Debian contact page .

Content Copyright © 1997 - 2023 SPI Inc. ; See license terms . Debian is a trademark of SPI Inc. Learn more about this site .

This service is sponsored by MIT Computer Science & Artificial Intelligence Lab .

  • Stack Overflow Public questions & answers
  • Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers
  • Talent Build your employer brand
  • Advertising Reach developers & technologists worldwide
  • About the company

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Can't get result from task list

I have this async function that returns a Task

Now I want to get all settings and then wait until all is completed like this

How to get the data from the task?

Salah Akbari's user avatar

Change your taskList to List<Task<SettingModel>> and also don't use task.Result to avoid Deadlock . Your code should be something like this:

Your Answer

Sign up or log in, post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct .

Not the answer you're looking for? Browse other questions tagged c# async-await or ask your own question .

Hot Network Questions

task t result

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy .

FAQs | Blog | Contact

ep-logo-design-standard-rgb

The Difference Between A Task-based And Results-based Company

Employee productivity and innovation are the fuel driving businesses forward. Involved and motivated employees generate ideas and plans , but they will stop if employees feel constrained by lock-step tasks. Managers face a constant struggle of keeping employees motivated and engaged while also staying within the parameters of a company’s policy.

A high motivation for original problem solving from employees is knowing their creative ideas won’t be shot down because they might not meet a checklist their company has in place. An efficient way to stimulate creativity is to minimize the feeling of micromanagement. A task that is easier said than done. But, one way to mitigate micromanagers and improve employee productivity is to make sure your company is focussed on the results of work and not on the procedural tasks employees take to get work done. Managers focusing on lists of tasks are a sure sign of micromanagement and micromanagers are killers of employee engagement and morale.

Task Based Cares About The “How” Of A Project

Task-based companies focus on the details they take to get to the end of a project. The problem with this approach is managers are more interested in making sure employees “check the boxes” on all the tasks they have to complete instead of focusing on the goal of a project.

Task-based companies make themselves fertile ground for micromanagement because people will be more interested in making sure they cover themselves if a problem arises. Since managers have to answer for their team’s work, they want to ensure their team completed every step possible, so nothing was left undone.

This type of mentality kills innovation and employee productivity because it stifles original thought. Employees will not feel comfortable changing anything because they don’t want to disappoint their boss. Bottom line, employees will be slaves to tasks and checklists, focusing on covering in order to avoid negative consequences rather than focusing on the actual goal of the project.

Result-Oriented Businesses Produce Results

Results-Oriented companies focus more on the “why” of a project. “Why” does the project exist and what is the result that’s needed to make it successful. This is a big shift from focusing on “how” the project is done. Employee productivity will be more efficient in companies focused on producing a quality product. When companies step away from unnecessary or mundane tasks, employees have more confidence to try innovative ideas. They look for more economical and efficient ways to solve problems because they aren’t tied to a checklist of steps, and this is the kind of work that saves companies time and money.

This doesn’t mean a results oriented business doesn’t have policies and procedures, they do, and they respect them. However, they are fluid in their implementation of the rules. If they see a certain task doesn’t need to be completed to get result, they won’t do it. They don’t burden employees with checklists, and they allow them to suggest ways to get to the results with minimal interference.

At Equal Parts Consulting we have seen task-based businesses stagnate because they didn’t allow employees to suggest or implement unconventional but effective ideas. Schedule a consultation with us if you would like to learn about new ways to conduct workflow and idea generation in your business.

Questions? Call 760-487-8664 to start a conversation.

task t result

Equal Parts works to create effective company cultures. We shift company culture, bring visibility to data, and optimize workflows.

© Equal Parts | Privacy Policy | Website Designed by New York Ave

Our Approach

Our results, questions call 760-487-8664.

IMAGES

  1. T-Test Results for Feeling of Job Security As a Factor Leading to Job

    task t result

  2. How To Report T Test Results In A Table

    task t result

  3. Two Sample t Test with Minitab

    task t result

  4. .net

    task t result

  5. T-test results on the difference in task fulfilment between pre-test

    task t result

  6. STAR: Situation, Task, Action, Result

    task t result

VIDEO

  1. 1 Litre WATER Drop!!! 😲Shocking Result😲 #shorts

  2. 🔴LIVE: Voting Result Today 8 AM

  3. 15TH APRIL IELTS EXAM 2023 READING ANSWERS

  4. TA Total Task with Least to Most Physical Prompt

  5. Tasklist D Part 1

  6. Task started

COMMENTS

  1. What is the difference between await Task<T> and Task<T>.Result?

    await task; will "yield" the current thread. task. Result will block the current threads. await is an asynchronous wait ; Result is a blocking wait

  2. Task<T>.Result used to block. Does it still?

    Task<T>.Result used to block. By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy

  3. [Solved] runtime Obsolete Task<T>.Result, Introduce Task<T>.TryGetResult

    My answer here hasn't changed from before:https://github.com/dotnet/corefx/issues/8931#issuecomment-259431624. But if the goal is to simply detect when blocking waits are being used

  4. Debian -- Package Search Results -- task-chinese-t

    You have searched for packages that names contain task-chinese-t in all suites, all sections, and all architectures. bullseye (stable) (tasks): Traditional Chinese environment 3.68+deb11u1: all

  5. Can't get result from task list

    By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy

  6. Resulted Controller Matrix of task T 1 .

    Download scientific diagram | Resulted Controller Matrix of task T 1 . from publication: R-Codesign: Codesign Methodology for Real-Time Reconfigurable Embedded Systems Under Energy Constraints

  7. The Difference Between A Task-based And Results-based Company

    Managers focusing on lists of tasks are a sure sign of micromanagement and micromanagers are killers of employee engagement and morale. Task-based companies focus on the details they take to get to the end of a project