using System;
using System.Threading.Tasks;
using System.Threading;
class Program
{
static void Main()
int x = 0;
do
Example();
Console.WriteLine("You typed: {0}", x);
x++;
Thread.Sleep(2000);
} while (x < 10);
}
static async void Example()
// This method runs asynchronously.
int t = await Task.Run(() => Allocate());
Console.WriteLine("Async Done: {0}", t);
static int Allocate()
// Compute total count of digits in strings.
int size = 0;
size++;
Thread.Sleep(1000);
while ( size < 10);
return size;