Skip to content

Give ToList preference for WhenAny #34606

@DickBaker

Description

@DickBaker

Docs suggest using LINQ extension method ToArray() to initiate execution. Whilst this is true and may be the right style for WhenAll() coding, I favour use of ToList() instead as this is more appropriate for the WhenAny() style [handy to handle completions as they arise] as often you have to .Remove() that completed Task from the in-progress list (s.t. all work is only complete when that list is empty). Would be good to explain & contrast imho. Thanks.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.


Associated WorkItem - 478688

Metadata

Metadata

Labels

📌 seQUESTeredIdentifies that an issue has been imported into Quest.async-task-programming/subsvcdotnet-csharp/svcin-prThis issue will be closed (fixed) by an active pull request.okr-qualityContent-quality KR: Concerns article defects (bugs), freshness, or build warnings.

Type

No type

Projects

Status

👀 In review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions