C# Task.ContinueWith 返回对象
使用Task.ContinueWith 可以在Task完成时而继续执行的逻辑
当在ContinueWith中需要返回一个对象时,应该如何使用
下方代码可以表示,在设置缓存完成后,重新读取缓存,并返回
var item = await SetCacheItemAsync("key", cacheItems) .ContinueWith<>(async _ => await cacheItem.GetAsync(key));
使用Task.ContinueWith 可以在Task完成时而继续执行的逻辑
当在ContinueWith中需要返回一个对象时,应该如何使用
下方代码可以表示,在设置缓存完成后,重新读取缓存,并返回
var item = await SetCacheItemAsync("key", cacheItems) .ContinueWith<>(async _ => await cacheItem.GetAsync(key));