次のコードがあります。
// Get all of the files from the local storage directory.
var files = await folder.GetFilesAsync();
// Map each file to a stream corresponding to that file.
var streams = files.Select(async f => { return await f.OpenStreamForWriteAsync(); });
streams
タイプであると予想しますIEnumerable<Stream>
が、実際には of ですIEnumberable<Task<Stream>>
。これは、 await キーワードを省略した場合に予想していたものです。の戻り値の型OpenStreamForWriteAsync
はTask<Stream>
— 確かにそれを待っているとStream
?を生成するはずです。
では、なぜ return await ステートメントが Task を返すのでしょうか?
ご協力いただきありがとうございます。