---
title: "Discussion on \"Await tasks with multiple result types\" | Hashnode"
description: "Discussion on \"Await tasks with multiple result types\". Regularly I want to await a few tasks and get their result. Surprisingly, there is no obvious way to do that. Task.WhenAll can be helpful, as we see later, but it doesn't solve the problem.My common scenario looks like this:\nvar dbTasks = getDataFrom..."
url: "https://hashnode.com/posts/await-tasks-with-multiple-result-types/60fd6a4531552277811af166"
---

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

Discussion

# [Await tasks with multiple result types](https://blog.ciechowski.net/await-tasks-with-multiple-result-types?utm_source=hashnode&utm_medium=feed)

Regularly I want to await a few tasks and get their result. Surprisingly, there is no obvious way to do that. Task.WhenAll can be helpful, as we see later, but it doesn't solve the problem.My common scenario looks like this: var dbTasks = getDataFrom...

Jul 25, 2021 · 2 min read · blog.ciechowski.net  
Updated Jul 28, 2021  
Read the article

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

## Written by

[Kuba Ciechowski](https://hashnode.com/@kciechowski)

@kciechowski · Gdańsk, Poland

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

soft skilled developer

## Responses 1

Markdown supported · ⌘↵ to post

[kndb](https://hashnode.com/@kndb)

[Jul 28, 2021](https://hashnode.com/posts/await-tasks-with-multiple-result-types/60fd6a4531552277811af166/comment/61017d17d3dd5634ae90859d)

Hey Kuba, nice article!

On

> Remember that supplied tasks has to have the same result type.

We should be able to do a Task.WhenAll on tasks with different return types.

```
await Task.WhenAll(taskReturnsInt, taskReturnsString);

// next lines would execute only after Task.WhenAll completed

// block and get result
var intResult = taskReturnsInt.Result;

// or asynchronously get result
var stringResult = await taskReturnsString;
```

[Kuba Ciechowski](https://hashnode.com/@kciechowski)

[Jul 28, 2021](https://hashnode.com/posts/await-tasks-with-multiple-result-types/60fd6a4531552277811af166/comment/61017d17d3dd5634ae90859d#reply-6101a0402db92534dc933ecb)

Hey kndb! You are right. Thank you for pointing this out :)
