このコードを考えてみましょう:
public async Task TheBestMethodEver1()
{
// code skipped
await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
// code skipped
});
}
public Task TheBestMethodEver2()
{
// code skipped
return Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
{
// code skipped
}).AsTask();
}
これらのメソッドは、次のように呼び出すことができます。
await TheBestMethodEverX();
これら 2 つの方法の違いは何ですか? また、通常、最初の方法を使用する必要があるのはなぜですか?