---
title: "Discussion on \"How to wait on two tasks?\" | Hashnode"
description: "Discussion on \"How to wait on two tasks?\". Suppose there are two async function GetX and GetY, then the code to get them to run in parallel and wait is.\nvar tx = GetX();\n var ty = GetY();\n var results = await Task.WhenAll(tx,ty);\n var z = results[0] + results[1];\nThe type for the function is\n..."
url: "https://hashnode.com/posts/how-to-wait-on-two-tasks/603543690dde8f7722d1e5a7"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to wait on two tasks?](https://cwizsoftware.com/how-to-wait-on-two-tasks?utm_source=hashnode&utm_medium=feed)

Suppose there are two async function GetX and GetY, then the code to get them to run in parallel and wait is. var tx = GetX(); var ty = GetY(); var results = await Task.WhenAll(tx,ty); var z = results\[0\] + results\[1\]; The type for the function is ...

Jun 23, 2017 · 1 min read · cwizsoftware.com  
Read the article

-   [#csharp](https://hashnode.com/tag/csharp)
-   [#async](https://hashnode.com/tag/async)

## Written by

[Xavier](https://hashnode.com/@xavier2021)

@xavier2021

  
[View profile](https://hashnode.com/@xavier2021)

C#

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
