0

I have the following Code

List<Task> tasks = new List<Task>();
            if (!string.IsNullOrEmpty(OrgLocationID))
            {
                tasks.Add(GetOrgLocations());
            }

           
            tasks.Add(GetOrg());
            tasks.Add(GetRoleTypes());
            tasks.Add(GetOrgOrLocationUserInfo());
            await Task.WhenAll(tasks);

How do i retrieve the results when each Task can return different data type ? Also how may i know if the some of them failed and may not return data ?

NSS
  • 1,835
  • 2
  • 29
  • 66
  • Can you clarify what problem you have using examples for previous versions of .Net/.Net core and why you need on specific for .Net Core 6 RC1 ? – Alexei Levenkov Sep 21 '21 at 04:00
  • I am not comparing between .NET versions. Just specifying the environment where I am running code; is using .NET 6 RC1, if don't specify obviously i expect that to come up as question down the line as to what framework am i using. – NSS Sep 21 '21 at 05:09
  • I did figure out solution , but since this is comment section , it is limiting the number of characters i can post, will wait till it enables me to write my own answer. – NSS Sep 21 '21 at 05:11
  • I'll save use the effort. If that duplicate is not what you looking for see if some other https://www.bing.com/search?q=How+to+Retrieve+Result+back+when+using+Task.WhenAll would do. – Alexei Levenkov Sep 21 '21 at 05:13
  • that link is helpful – NSS Sep 21 '21 at 05:18

0 Answers0