[转载]Get the result of multiple tasks in a ValueTuple and WhenAll

 

Get the result of multiple tasks in a ValueTuple and WhenAll

https://www.meziantou.net/get-the-result-of-multiple-tasks-in-a-valuetuple-and-whenall.htm

Task<int> task1 = Task.Run(() => 1);
Task<string> task2 = Task.Run(() => "meziantou");

await Task.WhenAll(task1, task2);
var task1Result = task1.Result; // or await task1
var task2Result = task2.Result; // or await task2

 

.Net中的不可变集合(Immutable Collection)简介

https://www.cnblogs.com/TianFang/p/3310662.html

  • ImmutableArray<T>
  • ImmutableStack<T>
  • ImmutableQueue<T>
  • ImmutableList<T>
  • ImmutableHashSet<T>
  • ImmutableSortedSet<T>
  • ImmutableDictionary<K, V>
  • ImmutableSortedDictionary<K, V>

posted on 2021-06-26 23:56  白马酒凉  阅读(33)  评论(0编辑  收藏  举报

导航