async static Task AsynchronousProcessing() { var sync = new CustomAwaitable(true); string result = await sync; Console.WriteLine(result); var async = new CustomAwaitable(false); result = await async; Console.WriteLine(result); }
public async Task CustomAwaitable() { var completedAwaitable = new CustomAwaitable( _testOutputHelper.WriteLine, isCompleted: true); await completedAwaitable; var incompletedAwaitable = new CustomAwaitable( _testOutputHelper.WriteLine, isCompleted: false); await incompletedAwaitable; }
async Task AsyncProcess() { var sync = new CustomAwaitable(true); string result = await sync; Console.WriteLine(result); var async = new CustomAwaitable(false); result = await async; Console.WriteLine(result); }
async Task AsynchronousProcessing() { var sync = new CustomAwaitable(true); string result = await sync; WriteLine(result); var async = new CustomAwaitable(false); result = await async; WriteLine(result); }
static async Task AsynchronousProcessing() { var sync = new CustomAwaitable(true); string result = await sync; // Completed synchronously Console.WriteLine(result); var async = new CustomAwaitable(false); result = await async; // Task is running on a thread id 3. Is thread pool thread: True Console.WriteLine(result); }