Skip to content

Instantly share code, notes, and snippets.

@jskeet
Created August 31, 2023 19:31
Show Gist options
  • Save jskeet/cb8d280ae9be1d627ab19e8a10d31488 to your computer and use it in GitHub Desktop.
Save jskeet/cb8d280ae9be1d627ab19e8a10d31488 to your computer and use it in GitHub Desktop.
using System.Threading.Tasks;
class Test
{
static async Task Main()
{
// (Include the error message in the post.)
_ = await Condition() ? await M1() : await M2();
}
static Task<bool> Condition() => Task.FromResult(true);
static Task M1() => Task.CompletedTask;
static Task M2() => Task.CompletedTask;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment