As of C# 7.0 async methods can return ValueTask<T>. The explanation says that it should be used when we have a cached result or simulating async via synchronous code. However I still do not understand what is the problem with using ValueTask always or in fact why async/await wasn't built with a value type from the start. When would ValueTask fail to do the job?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…